summaryrefslogtreecommitdiff
path: root/Zend/tests
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests')
-rw-r--r--Zend/tests/001.phpt35
-rw-r--r--Zend/tests/002.phpt132
-rw-r--r--Zend/tests/003.phpt33
-rw-r--r--Zend/tests/004.phpt17
-rw-r--r--Zend/tests/005.phpt5
-rw-r--r--Zend/tests/006.phpt18
-rw-r--r--Zend/tests/007.phpt65
-rw-r--r--Zend/tests/008.phpt36
-rw-r--r--Zend/tests/009.phpt46
-rw-r--r--Zend/tests/010.phpt59
-rw-r--r--Zend/tests/011.phpt80
-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.phpt32
-rw-r--r--Zend/tests/017.phpt23
-rw-r--r--Zend/tests/018.phpt24
-rw-r--r--Zend/tests/019.phpt230
-rw-r--r--Zend/tests/020.phpt35
-rw-r--r--Zend/tests/022.phpt13
-rw-r--r--Zend/tests/023.phpt16
-rw-r--r--Zend/tests/024.phpt32
-rw-r--r--Zend/tests/025.phpt6
-rw-r--r--Zend/tests/026.phpt15
-rw-r--r--Zend/tests/028.phpt4
-rw-r--r--Zend/tests/030.phpt34
-rw-r--r--Zend/tests/033.phpt56
-rw-r--r--Zend/tests/034.phpt30
-rw-r--r--Zend/tests/036.phpt16
-rw-r--r--Zend/tests/037.phpt2
-rw-r--r--Zend/tests/038.phpt12
-rw-r--r--Zend/tests/ErrorException_construct.phpt63
-rw-r--r--Zend/tests/access_modifiers_001.phpt4
-rw-r--r--Zend/tests/access_modifiers_002.phpt2
-rw-r--r--Zend/tests/access_modifiers_003.phpt2
-rw-r--r--Zend/tests/access_modifiers_004.phpt4
-rw-r--r--Zend/tests/access_modifiers_005.phpt4
-rw-r--r--Zend/tests/access_modifiers_006.phpt4
-rw-r--r--Zend/tests/access_modifiers_007.phpt2
-rw-r--r--Zend/tests/access_modifiers_008.phpt8
-rw-r--r--Zend/tests/access_modifiers_009.phpt14
-rw-r--r--Zend/tests/access_modifiers_010.phpt20
-rw-r--r--Zend/tests/access_modifiers_011.phpt36
-rw-r--r--Zend/tests/access_modifiers_012.phpt6
-rw-r--r--Zend/tests/access_modifiers_013.phpt2
-rw-r--r--Zend/tests/add_002.phpt12
-rw-r--r--Zend/tests/add_003.phpt12
-rw-r--r--Zend/tests/add_004.phpt8
-rw-r--r--Zend/tests/add_005.phpt4
-rw-r--r--Zend/tests/add_006.phpt26
-rw-r--r--Zend/tests/add_007.phpt12
-rw-r--r--Zend/tests/alternative_offset_syntax_compile_error_in_const_expr.phpt9
-rw-r--r--Zend/tests/alternative_offset_syntax_compile_error_outside_const_expr.phpt9
-rw-r--r--Zend/tests/anon/001.phpt1
-rw-r--r--Zend/tests/anon/002.phpt1
-rw-r--r--Zend/tests/anon/003.phpt1
-rw-r--r--Zend/tests/anon/004.phpt1
-rw-r--r--Zend/tests/anon/005.phpt1
-rw-r--r--Zend/tests/anon/006.phpt1
-rw-r--r--Zend/tests/anon/007.phpt1
-rw-r--r--Zend/tests/anon/008.phpt1
-rw-r--r--Zend/tests/anon/009.phpt1
-rw-r--r--Zend/tests/anon/011.phpt6
-rw-r--r--Zend/tests/anon_class_name.phpt30
-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/arg_unpack/non_integer_keys.phpt12
-rw-r--r--Zend/tests/arg_unpack/string_keys.phpt12
-rw-r--r--Zend/tests/arginfo_zpp_mismatch.inc39
-rw-r--r--Zend/tests/arginfo_zpp_mismatch.phpt83
-rw-r--r--Zend/tests/arginfo_zpp_mismatch_strict.phpt85
-rw-r--r--Zend/tests/argument_restriction_001.phpt10
-rw-r--r--Zend/tests/argument_restriction_002.phpt10
-rw-r--r--Zend/tests/argument_restriction_003.phpt10
-rw-r--r--Zend/tests/argument_restriction_004.phpt6
-rw-r--r--Zend/tests/argument_restriction_005.phpt6
-rw-r--r--Zend/tests/argument_restriction_006.phpt10
-rw-r--r--Zend/tests/array_append_COW.phpt12
-rw-r--r--Zend/tests/array_hash_zero.phpt6
-rw-r--r--Zend/tests/array_literal_next_element_error.phpt31
-rw-r--r--Zend/tests/array_offset.phpt10
-rw-r--r--Zend/tests/array_unpack/already_occupied.phpt48
-rw-r--r--Zend/tests/array_unpack/basic.phpt9
-rw-r--r--Zend/tests/array_unpack/classes.phpt17
-rw-r--r--Zend/tests/array_unpack/non_integer_keys.phpt9
-rw-r--r--Zend/tests/array_unpack/ref1.phpt1
-rw-r--r--Zend/tests/array_unpack/string_keys.phpt13
-rw-r--r--Zend/tests/array_unpack/undef_var.phpt5
-rw-r--r--Zend/tests/array_unshift_COW.phpt12
-rw-r--r--Zend/tests/arrow_functions/002.phpt2
-rw-r--r--Zend/tests/arrow_functions/003.phpt4
-rw-r--r--Zend/tests/arrow_functions/006.phpt4
-rw-r--r--Zend/tests/arrow_functions/007.phpt3
-rw-r--r--Zend/tests/assert/bug70208.phpt24
-rw-r--r--Zend/tests/assert/expect_015.phpt252
-rw-r--r--Zend/tests/assert/expect_020.phpt4
-rw-r--r--Zend/tests/assert/indirect_var_access_misoptimization.phpt21
-rw-r--r--Zend/tests/assign_concat_array_empty_string.phpt2
-rw-r--r--Zend/tests/assign_dim_obj_null_return.phpt101
-rw-r--r--Zend/tests/assign_obj_ref_return.phpt18
-rw-r--r--Zend/tests/assign_ref_error_var_handling.phpt31
-rw-r--r--Zend/tests/assign_to_obj_002.phpt2
-rw-r--r--Zend/tests/assign_to_var_003.phpt2
-rw-r--r--Zend/tests/ast/zend-pow-assign.phpt2
-rw-r--r--Zend/tests/ast_serialize_backtick_literal.phpt2
-rw-r--r--Zend/tests/attributes/001_placement.phpt134
-rw-r--r--Zend/tests/attributes/002_rfcexample.phpt43
-rw-r--r--Zend/tests/attributes/003_ast_nodes.phpt108
-rw-r--r--Zend/tests/attributes/004_name_resolution.phpt96
-rw-r--r--Zend/tests/attributes/005_objects.phpt120
-rw-r--r--Zend/tests/attributes/006_filter.phpt112
-rw-r--r--Zend/tests/attributes/007_self_reflect_attribute.phpt23
-rw-r--r--Zend/tests/attributes/008_wrong_attribution.phpt10
-rw-r--r--Zend/tests/attributes/009_doctrine_annotations_example.phpt161
-rw-r--r--Zend/tests/attributes/010_unsupported_const_expression.phpt11
-rw-r--r--Zend/tests/attributes/011_inheritance.phpt99
-rw-r--r--Zend/tests/attributes/012_ast_export.phpt58
-rw-r--r--Zend/tests/attributes/013_class_scope.phpt117
-rw-r--r--Zend/tests/attributes/014_class_const_group.phpt36
-rw-r--r--Zend/tests/attributes/015_property_group.phpt36
-rw-r--r--Zend/tests/attributes/016_custom_attribute_validation.phpt16
-rw-r--r--Zend/tests/attributes/017_closure_scope.phpt53
-rw-r--r--Zend/tests/attributes/018_fatal_error_in_argument.phpt11
-rw-r--r--Zend/tests/attributes/019_variable_attribute_name.phpt11
-rw-r--r--Zend/tests/attributes/020_userland_attribute_validation.phpt70
-rw-r--r--Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt11
-rw-r--r--Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt11
-rw-r--r--Zend/tests/attributes/023_ast_node_in_validation.phpt11
-rw-r--r--Zend/tests/attributes/024_internal_target_validation.phpt11
-rw-r--r--Zend/tests/attributes/025_internal_repeatable_validation.phpt12
-rw-r--r--Zend/tests/attributes/026_unpack_in_args.phpt11
-rw-r--r--Zend/tests/attributes/027_trailing_comma_args.phpt30
-rw-r--r--Zend/tests/attributes/028_grouped.phpt55
-rw-r--r--Zend/tests/attributes/029_reflect_internal_symbols.phpt32
-rw-r--r--Zend/tests/attributes/030_strict_types.inc5
-rw-r--r--Zend/tests/attributes/030_strict_types.phpt31
-rw-r--r--Zend/tests/attributes/031_backtrace.phpt97
-rw-r--r--Zend/tests/attributes/032_attribute_validation_scope.phpt9
-rw-r--r--Zend/tests/binary-32bit.phpt45
-rw-r--r--Zend/tests/binary.phpt13
-rw-r--r--Zend/tests/break_error_001.phpt2
-rw-r--r--Zend/tests/break_error_002.phpt2
-rw-r--r--Zend/tests/break_error_003.phpt2
-rw-r--r--Zend/tests/break_error_004.phpt6
-rw-r--r--Zend/tests/bug18556.phpt4
-rw-r--r--Zend/tests/bug20242.phpt12
-rw-r--r--Zend/tests/bug22836.phpt10
-rw-r--r--Zend/tests/bug23104.phpt2
-rw-r--r--Zend/tests/bug24635.phpt22
-rw-r--r--Zend/tests/bug24773.phpt6
-rw-r--r--Zend/tests/bug26010.phpt6
-rw-r--r--Zend/tests/bug26166.phpt18
-rw-r--r--Zend/tests/bug26229.phpt12
-rw-r--r--Zend/tests/bug26281.phpt12
-rw-r--r--Zend/tests/bug26696.phpt18
-rw-r--r--Zend/tests/bug26697.phpt10
-rw-r--r--Zend/tests/bug26698.phpt88
-rw-r--r--Zend/tests/bug26801.phpt8
-rw-r--r--Zend/tests/bug26802.phpt14
-rw-r--r--Zend/tests/bug27304.phpt10
-rw-r--r--Zend/tests/bug27669.phpt19
-rw-r--r--Zend/tests/bug27731.phpt6
-rw-r--r--Zend/tests/bug27798.phpt32
-rw-r--r--Zend/tests/bug28442.phpt2
-rw-r--r--Zend/tests/bug28444.phpt50
-rw-r--r--Zend/tests/bug29015.phpt2
-rw-r--r--Zend/tests/bug29210.phpt28
-rw-r--r--Zend/tests/bug29368.phpt24
-rw-r--r--Zend/tests/bug29368_2.phpt14
-rw-r--r--Zend/tests/bug29368_3.phpt30
-rw-r--r--Zend/tests/bug29505.phpt2
-rw-r--r--Zend/tests/bug29674.phpt16
-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/bug30140.phpt6
-rw-r--r--Zend/tests/bug30162.phpt44
-rw-r--r--Zend/tests/bug30346.phpt2
-rw-r--r--Zend/tests/bug30394.phpt18
-rw-r--r--Zend/tests/bug30407.phpt6
-rw-r--r--Zend/tests/bug30451.phpt20
-rw-r--r--Zend/tests/bug30519.phpt2
-rw-r--r--Zend/tests/bug30702.phpt2
-rw-r--r--Zend/tests/bug30707.phpt28
-rw-r--r--Zend/tests/bug30725.phpt24
-rw-r--r--Zend/tests/bug30828.phpt58
-rw-r--r--Zend/tests/bug30922.phpt2
-rw-r--r--Zend/tests/bug30998.phpt6
-rw-r--r--Zend/tests/bug31098.phpt27
-rw-r--r--Zend/tests/bug31102.phpt49
-rw-r--r--Zend/tests/bug31177-2.phpt1
-rw-r--r--Zend/tests/bug31177.phpt30
-rw-r--r--Zend/tests/bug31341.phpt20
-rw-r--r--Zend/tests/bug31720.phpt13
-rw-r--r--Zend/tests/bug32226.phpt4
-rw-r--r--Zend/tests/bug32252.phpt42
-rw-r--r--Zend/tests/bug32290.phpt139
-rw-r--r--Zend/tests/bug32296.phpt28
-rw-r--r--Zend/tests/bug32427.phpt8
-rw-r--r--Zend/tests/bug32429.phpt20
-rw-r--r--Zend/tests/bug32660.phpt18
-rw-r--r--Zend/tests/bug32674.phpt14
-rw-r--r--Zend/tests/bug32799.phpt14
-rw-r--r--Zend/tests/bug33116.phpt2
-rw-r--r--Zend/tests/bug33171.phpt18
-rw-r--r--Zend/tests/bug33282.phpt10
-rw-r--r--Zend/tests/bug33512.phpt82
-rw-r--r--Zend/tests/bug33710.phpt26
-rw-r--r--Zend/tests/bug33771.phpt4
-rw-r--r--Zend/tests/bug33996.phpt8
-rw-r--r--Zend/tests/bug33999.phpt4
-rw-r--r--Zend/tests/bug34062.phpt8
-rw-r--r--Zend/tests/bug34064.phpt2
-rw-r--r--Zend/tests/bug34310.phpt6
-rw-r--r--Zend/tests/bug34467.phpt12
-rw-r--r--Zend/tests/bug34678.phpt16
-rw-r--r--Zend/tests/bug34786.phpt6
-rw-r--r--Zend/tests/bug34873.phpt20
-rw-r--r--Zend/tests/bug34893.phpt28
-rw-r--r--Zend/tests/bug35017.phpt16
-rw-r--r--Zend/tests/bug35163_2.phpt18
-rw-r--r--Zend/tests/bug35437.phpt27
-rw-r--r--Zend/tests/bug36006.phpt26
-rw-r--r--Zend/tests/bug36268.phpt7
-rw-r--r--Zend/tests/bug36303.phpt14
-rw-r--r--Zend/tests/bug37138.phpt8
-rw-r--r--Zend/tests/bug37212.phpt2
-rw-r--r--Zend/tests/bug37251.phpt11
-rw-r--r--Zend/tests/bug37632.phpt108
-rw-r--r--Zend/tests/bug37667.phpt14
-rw-r--r--Zend/tests/bug37707.phpt6
-rw-r--r--Zend/tests/bug37715.phpt1
-rw-r--r--Zend/tests/bug37811.phpt35
-rw-r--r--Zend/tests/bug38047.phpt51
-rw-r--r--Zend/tests/bug38220.phpt60
-rw-r--r--Zend/tests/bug38234.phpt10
-rw-r--r--Zend/tests/bug38469.phpt12
-rw-r--r--Zend/tests/bug38623.phpt10
-rw-r--r--Zend/tests/bug38772.phpt25
-rw-r--r--Zend/tests/bug38779.phpt42
-rw-r--r--Zend/tests/bug38779_1.phpt44
-rw-r--r--Zend/tests/bug38942.phpt18
-rw-r--r--Zend/tests/bug39003.phpt6
-rw-r--r--Zend/tests/bug39018.phpt40
-rw-r--r--Zend/tests/bug39018_2.phpt7
-rw-r--r--Zend/tests/bug39036.phpt4
-rw-r--r--Zend/tests/bug39127.phpt22
-rw-r--r--Zend/tests/bug39297.phpt4
-rw-r--r--Zend/tests/bug39304.phpt2
-rw-r--r--Zend/tests/bug39346.phpt18
-rw-r--r--Zend/tests/bug39438.phpt52
-rw-r--r--Zend/tests/bug39445.phpt12
-rw-r--r--Zend/tests/bug39542.phpt4
-rw-r--r--Zend/tests/bug39542/bug39542.inc6
-rw-r--r--Zend/tests/bug39721.phpt14
-rw-r--r--Zend/tests/bug39775.phpt10
-rw-r--r--Zend/tests/bug39825.phpt2
-rw-r--r--Zend/tests/bug39944.phpt30
-rw-r--r--Zend/tests/bug40236.phpt1
-rw-r--r--Zend/tests/bug40509.phpt9
-rw-r--r--Zend/tests/bug40621.phpt15
-rw-r--r--Zend/tests/bug40705.phpt3
-rw-r--r--Zend/tests/bug40770.phpt2
-rw-r--r--Zend/tests/bug40784.phpt25
-rw-r--r--Zend/tests/bug40815.phpt6
-rw-r--r--Zend/tests/bug40833.phpt98
-rw-r--r--Zend/tests/bug41026.phpt18
-rw-r--r--Zend/tests/bug41075.phpt31
-rw-r--r--Zend/tests/bug41209.phpt4
-rw-r--r--Zend/tests/bug41401.phpt1
-rw-r--r--Zend/tests/bug41421.phpt12
-rw-r--r--Zend/tests/bug41633_1.phpt4
-rw-r--r--Zend/tests/bug41633_2.phpt4
-rw-r--r--Zend/tests/bug41633_3.phpt6
-rw-r--r--Zend/tests/bug41633_4.phpt4
-rw-r--r--Zend/tests/bug41640.phpt1
-rw-r--r--Zend/tests/bug42211.phpt1
-rw-r--r--Zend/tests/bug42798.phpt1
-rw-r--r--Zend/tests/bug42802.phpt7
-rw-r--r--Zend/tests/bug42819.phpt90
-rw-r--r--Zend/tests/bug42820.phpt3
-rw-r--r--Zend/tests/bug42937.phpt30
-rw-r--r--Zend/tests/bug43183.phpt1
-rw-r--r--Zend/tests/bug43200.phpt10
-rw-r--r--Zend/tests/bug43200_2.phpt10
-rw-r--r--Zend/tests/bug43201.phpt30
-rw-r--r--Zend/tests/bug43323.phpt14
-rw-r--r--Zend/tests/bug43332_1.phpt3
-rw-r--r--Zend/tests/bug43332_2.phpt1
-rw-r--r--Zend/tests/bug43343.phpt2
-rw-r--r--Zend/tests/bug43344_1.phpt51
-rw-r--r--Zend/tests/bug43344_10.phpt2
-rw-r--r--Zend/tests/bug43344_11.phpt4
-rw-r--r--Zend/tests/bug43344_12.phpt4
-rw-r--r--Zend/tests/bug43344_13.phpt6
-rw-r--r--Zend/tests/bug43344_2.phpt2
-rw-r--r--Zend/tests/bug43344_3.phpt4
-rw-r--r--Zend/tests/bug43344_4.phpt4
-rw-r--r--Zend/tests/bug43344_5.phpt6
-rw-r--r--Zend/tests/bug43344_6.phpt2
-rw-r--r--Zend/tests/bug43344_7.phpt4
-rw-r--r--Zend/tests/bug43344_8.phpt4
-rw-r--r--Zend/tests/bug43344_9.phpt6
-rw-r--r--Zend/tests/bug43450.phpt14
-rw-r--r--Zend/tests/bug43483.phpt14
-rw-r--r--Zend/tests/bug43651.phpt1
-rw-r--r--Zend/tests/bug43851.phpt6
-rw-r--r--Zend/tests/bug44069.phpt10
-rw-r--r--Zend/tests/bug44141.phpt3
-rw-r--r--Zend/tests/bug44184.phpt18
-rw-r--r--Zend/tests/bug44653.phpt4
-rw-r--r--Zend/tests/bug44660.phpt60
-rw-r--r--Zend/tests/bug44827.phpt22
-rw-r--r--Zend/tests/bug44899.phpt20
-rw-r--r--Zend/tests/bug44899_2.phpt32
-rw-r--r--Zend/tests/bug45147.phpt2
-rw-r--r--Zend/tests/bug45180.phpt30
-rw-r--r--Zend/tests/bug45186.phpt49
-rw-r--r--Zend/tests/bug45186_2.phpt50
-rw-r--r--Zend/tests/bug45744.phpt7
-rw-r--r--Zend/tests/bug45805.phpt2
-rw-r--r--Zend/tests/bug45877.phpt8
-rw-r--r--Zend/tests/bug45910.phpt24
-rw-r--r--Zend/tests/bug45910_2.phpt24
-rw-r--r--Zend/tests/bug46106.phpt11
-rw-r--r--Zend/tests/bug46196.phpt8
-rw-r--r--Zend/tests/bug46246.phpt28
-rw-r--r--Zend/tests/bug46304.phpt47
-rw-r--r--Zend/tests/bug46381.phpt6
-rw-r--r--Zend/tests/bug46701.phpt14
-rw-r--r--Zend/tests/bug46813.phpt6
-rw-r--r--Zend/tests/bug47054.phpt16
-rw-r--r--Zend/tests/bug47109.phpt4
-rw-r--r--Zend/tests/bug47165.phpt12
-rw-r--r--Zend/tests/bug47320.phpt26
-rw-r--r--Zend/tests/bug47343.phpt44
-rw-r--r--Zend/tests/bug47353.phpt20
-rw-r--r--Zend/tests/bug47572.phpt5
-rw-r--r--Zend/tests/bug47593.phpt4
-rw-r--r--Zend/tests/bug47699.phpt8
-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/bug48215.phpt34
-rw-r--r--Zend/tests/bug48215_2.phpt10
-rw-r--r--Zend/tests/bug48228.phpt16
-rw-r--r--Zend/tests/bug48408.phpt16
-rw-r--r--Zend/tests/bug48409.phpt72
-rw-r--r--Zend/tests/bug48428.phpt6
-rw-r--r--Zend/tests/bug48533.phpt40
-rw-r--r--Zend/tests/bug48667_1.phpt2
-rw-r--r--Zend/tests/bug48693.phpt52
-rw-r--r--Zend/tests/bug48770.phpt49
-rw-r--r--Zend/tests/bug48770_2.phpt78
-rw-r--r--Zend/tests/bug48770_3.phpt61
-rw-r--r--Zend/tests/bug48899.phpt12
-rw-r--r--Zend/tests/bug48912.phpt2
-rw-r--r--Zend/tests/bug49472.phpt10
-rw-r--r--Zend/tests/bug49866.phpt1
-rw-r--r--Zend/tests/bug49893.phpt26
-rw-r--r--Zend/tests/bug49908.phpt22
-rw-r--r--Zend/tests/bug50005.phpt6
-rw-r--r--Zend/tests/bug50174.phpt12
-rw-r--r--Zend/tests/bug50261.phpt39
-rw-r--r--Zend/tests/bug50383.phpt30
-rw-r--r--Zend/tests/bug50394.phpt3
-rw-r--r--Zend/tests/bug50816.phpt1
-rw-r--r--Zend/tests/bug51176.phpt28
-rw-r--r--Zend/tests/bug51394.phpt7
-rw-r--r--Zend/tests/bug51421.phpt4
-rw-r--r--Zend/tests/bug51791.phpt11
-rw-r--r--Zend/tests/bug51822.phpt22
-rw-r--r--Zend/tests/bug51827.phpt10
-rw-r--r--Zend/tests/bug52001.phpt4
-rw-r--r--Zend/tests/bug52041.phpt112
-rw-r--r--Zend/tests/bug52051.phpt34
-rw-r--r--Zend/tests/bug52160.phpt34
-rw-r--r--Zend/tests/bug52193.phpt2
-rw-r--r--Zend/tests/bug52237.phpt11
-rw-r--r--Zend/tests/bug52355.phpt8
-rw-r--r--Zend/tests/bug52361.phpt24
-rw-r--r--Zend/tests/bug52484.phpt8
-rw-r--r--Zend/tests/bug52484_2.phpt8
-rw-r--r--Zend/tests/bug52484_3.phpt8
-rw-r--r--Zend/tests/bug52614.phpt84
-rw-r--r--Zend/tests/bug52879.phpt9
-rw-r--r--Zend/tests/bug52940.phpt4
-rw-r--r--Zend/tests/bug53305.phpt2
-rw-r--r--Zend/tests/bug53432.phpt12
-rw-r--r--Zend/tests/bug53511.phpt19
-rw-r--r--Zend/tests/bug53727.phpt1
-rw-r--r--Zend/tests/bug54039.phpt47
-rw-r--r--Zend/tests/bug54262.phpt17
-rw-r--r--Zend/tests/bug54265.phpt16
-rw-r--r--Zend/tests/bug54268.phpt3
-rw-r--r--Zend/tests/bug54305.phpt17
-rw-r--r--Zend/tests/bug54358.phpt4
-rw-r--r--Zend/tests/bug54367.phpt2
-rw-r--r--Zend/tests/bug54547.phpt3
-rw-r--r--Zend/tests/bug54585.phpt17
-rw-r--r--Zend/tests/bug54624.phpt16
-rw-r--r--Zend/tests/bug54910.phpt1
-rw-r--r--Zend/tests/bug55086.phpt2
-rw-r--r--Zend/tests/bug55156.phpt22
-rw-r--r--Zend/tests/bug55247.phpt5
-rw-r--r--Zend/tests/bug55578.phpt2
-rw-r--r--Zend/tests/bug55825.phpt9
-rw-r--r--Zend/tests/bug60099.phpt4
-rw-r--r--Zend/tests/bug60169.phpt1
-rw-r--r--Zend/tests/bug60362.phpt1
-rw-r--r--Zend/tests/bug60444.phpt13
-rw-r--r--Zend/tests/bug60536_001.phpt14
-rw-r--r--Zend/tests/bug60536_002.phpt4
-rw-r--r--Zend/tests/bug60536_004.phpt2
-rw-r--r--Zend/tests/bug60536_005.phpt2
-rw-r--r--Zend/tests/bug60569.phptbin288 -> 297 bytes
-rw-r--r--Zend/tests/bug60573.phpt30
-rw-r--r--Zend/tests/bug60573_2.phpt64
-rw-r--r--Zend/tests/bug60598.phpt6
-rw-r--r--Zend/tests/bug60611.phpt8
-rw-r--r--Zend/tests/bug60613.phpt1
-rw-r--r--Zend/tests/bug60825.phpt10
-rw-r--r--Zend/tests/bug60833.phpt24
-rw-r--r--Zend/tests/bug60909_1.phpt5
-rw-r--r--Zend/tests/bug60909_2.phpt1
-rw-r--r--Zend/tests/bug60978.phpt6
-rw-r--r--Zend/tests/bug61011.phpt48
-rw-r--r--Zend/tests/bug61025.phpt10
-rw-r--r--Zend/tests/bug61095.phpt2
-rw-r--r--Zend/tests/bug61165.phpt7
-rw-r--r--Zend/tests/bug61225.phpt2
-rw-r--r--Zend/tests/bug61273.phpt3
-rw-r--r--Zend/tests/bug61362.phpt8
-rw-r--r--Zend/tests/bug61767.phpt7
-rw-r--r--Zend/tests/bug61782.phpt1
-rw-r--r--Zend/tests/bug61970.phpt1
-rw-r--r--Zend/tests/bug61970_1.phpt1
-rw-r--r--Zend/tests/bug61970_2.phpt1
-rw-r--r--Zend/tests/bug62005.phpt17
-rw-r--r--Zend/tests/bug62069.phpt32
-rw-r--r--Zend/tests/bug62069_2.phpt35
-rw-r--r--Zend/tests/bug62097.phpt9
-rw-r--r--Zend/tests/bug62609.phpt12
-rw-r--r--Zend/tests/bug62609_2.phpt22
-rw-r--r--Zend/tests/bug62956.phpt8
-rw-r--r--Zend/tests/bug63111.phpt6
-rw-r--r--Zend/tests/bug63206.phpt2
-rw-r--r--Zend/tests/bug63206_1.phpt2
-rw-r--r--Zend/tests/bug63206_2.phpt2
-rw-r--r--Zend/tests/bug63336.phpt22
-rw-r--r--Zend/tests/bug63462.phpt52
-rw-r--r--Zend/tests/bug63468.phpt25
-rw-r--r--Zend/tests/bug63635.phpt45
-rw-r--r--Zend/tests/bug63762.phpt10
-rw-r--r--Zend/tests/bug63982.phpt1
-rw-r--r--Zend/tests/bug64135.phpt1
-rw-r--r--Zend/tests/bug64239_1.phpt7
-rw-r--r--Zend/tests/bug64239_2.phpt20
-rw-r--r--Zend/tests/bug64239_3.phpt12
-rw-r--r--Zend/tests/bug64239_4.phpt12
-rw-r--r--Zend/tests/bug64417.phpt3
-rw-r--r--Zend/tests/bug64515.phpt2
-rw-r--r--Zend/tests/bug64578.phpt5
-rw-r--r--Zend/tests/bug64677.phpt6
-rw-r--r--Zend/tests/bug64821.1.phpt12
-rw-r--r--Zend/tests/bug64821.2.phpt6
-rw-r--r--Zend/tests/bug64821.3.phpt8
-rw-r--r--Zend/tests/bug64896.phpt20
-rw-r--r--Zend/tests/bug64960.phpt22
-rw-r--r--Zend/tests/bug64966.phpt20
-rw-r--r--Zend/tests/bug64988.phpt27
-rw-r--r--Zend/tests/bug65108.phpt13
-rw-r--r--Zend/tests/bug65254.phpt1
-rw-r--r--Zend/tests/bug65291.phpt10
-rw-r--r--Zend/tests/bug65322.phpt4
-rw-r--r--Zend/tests/bug65579.phpt2
-rw-r--r--Zend/tests/bug65784.phpt73
-rw-r--r--Zend/tests/bug65911.phpt12
-rw-r--r--Zend/tests/bug66015.phpt3
-rw-r--r--Zend/tests/bug66218.phpt7
-rw-r--r--Zend/tests/bug66252.phpt5
-rw-r--r--Zend/tests/bug66608.phpt105
-rw-r--r--Zend/tests/bug66609.phpt18
-rw-r--r--Zend/tests/bug67314.phpt5
-rw-r--r--Zend/tests/bug67368.phpt3
-rw-r--r--Zend/tests/bug67436/a.inc10
-rw-r--r--Zend/tests/bug67436/b.inc10
-rw-r--r--Zend/tests/bug67436/bug67436.phpt13
-rw-r--r--Zend/tests/bug67436/bug67436_nohandler.phpt9
-rw-r--r--Zend/tests/bug67436/c.inc2
-rw-r--r--Zend/tests/bug67856.phpt13
-rw-r--r--Zend/tests/bug67858.phpt21
-rw-r--r--Zend/tests/bug67922.phpt6
-rw-r--r--Zend/tests/bug67938.phpt2
-rw-r--r--Zend/tests/bug68215.phpt68
-rw-r--r--Zend/tests/bug68370.phpt9
-rw-r--r--Zend/tests/bug68446.phpt8
-rw-r--r--Zend/tests/bug68475.phpt2
-rw-r--r--Zend/tests/bug68797.phpt2
-rw-r--r--Zend/tests/bug68896.phpt9
-rw-r--r--Zend/tests/bug69017.phpt20
-rw-r--r--Zend/tests/bug69025.phpt6
-rw-r--r--Zend/tests/bug69084.phpt29
-rw-r--r--Zend/tests/bug69092.2.phpt2
-rw-r--r--Zend/tests/bug69092.phpt2
-rw-r--r--Zend/tests/bug69124.phpt8
-rw-r--r--Zend/tests/bug69167.phpt2
-rw-r--r--Zend/tests/bug69174.phpt12
-rw-r--r--Zend/tests/bug69201.phpt18
-rw-r--r--Zend/tests/bug69212.phpt12
-rw-r--r--Zend/tests/bug69221.phpt2
-rw-r--r--Zend/tests/bug69315.phpt62
-rw-r--r--Zend/tests/bug69388.phpt10
-rw-r--r--Zend/tests/bug69388_2.phpt2
-rw-r--r--Zend/tests/bug69420.phpt18
-rw-r--r--Zend/tests/bug69427.phpt16
-rw-r--r--Zend/tests/bug69446.phpt11
-rw-r--r--Zend/tests/bug69446_2.phpt21
-rw-r--r--Zend/tests/bug69676.phpt6
-rw-r--r--Zend/tests/bug69732.phpt5
-rw-r--r--Zend/tests/bug69754.phpt10
-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/bug69802_2.phpt3
-rw-r--r--Zend/tests/bug69832.phpt10
-rw-r--r--Zend/tests/bug69871.phpt6
-rw-r--r--Zend/tests/bug69891.phpt1
-rw-r--r--Zend/tests/bug69955.phpt1
-rw-r--r--Zend/tests/bug69957.phpt81
-rw-r--r--Zend/tests/bug69996.phpt10
-rw-r--r--Zend/tests/bug70012.phpt30
-rw-r--r--Zend/tests/bug70083.phpt8
-rw-r--r--Zend/tests/bug70089.phpt18
-rw-r--r--Zend/tests/bug70117.phpt11
-rw-r--r--Zend/tests/bug70121.phpt8
-rw-r--r--Zend/tests/bug70124.phpt24
-rw-r--r--Zend/tests/bug70156.phpt36
-rw-r--r--Zend/tests/bug70164.phpt12
-rw-r--r--Zend/tests/bug70179.phpt6
-rw-r--r--Zend/tests/bug70187.phpt2
-rw-r--r--Zend/tests/bug70215.phpt9
-rw-r--r--Zend/tests/bug70241.phpt4
-rw-r--r--Zend/tests/bug70258.phpt16
-rw-r--r--Zend/tests/bug70288.phpt8
-rw-r--r--Zend/tests/bug70321.phpt40
-rw-r--r--Zend/tests/bug70332.phpt2
-rw-r--r--Zend/tests/bug70430.phpt2
-rw-r--r--Zend/tests/bug70478.phpt10
-rw-r--r--Zend/tests/bug70547.phpt44
-rw-r--r--Zend/tests/bug70681.phpt2
-rw-r--r--Zend/tests/bug70689.phpt8
-rw-r--r--Zend/tests/bug70785.phpt12
-rw-r--r--Zend/tests/bug70805.phpt20
-rw-r--r--Zend/tests/bug70805_1.phpt18
-rw-r--r--Zend/tests/bug70805_2.phpt17
-rw-r--r--Zend/tests/bug70873.phpt14
-rw-r--r--Zend/tests/bug70895.phpt28
-rw-r--r--Zend/tests/bug70898.phpt26
-rw-r--r--Zend/tests/bug70912.phpt2
-rw-r--r--Zend/tests/bug70914.phpt12
-rw-r--r--Zend/tests/bug70918.phpt36
-rw-r--r--Zend/tests/bug70944.phpt28
-rw-r--r--Zend/tests/bug70957.phpt2
-rw-r--r--Zend/tests/bug70958.phpt8
-rw-r--r--Zend/tests/bug70967.phpt6
-rw-r--r--Zend/tests/bug70997.phpt1
-rw-r--r--Zend/tests/bug71067.phpt15
-rw-r--r--Zend/tests/bug71163.phpt16
-rw-r--r--Zend/tests/bug71221.phpt10
-rw-r--r--Zend/tests/bug71275.phpt14
-rw-r--r--Zend/tests/bug71300.phpt18
-rw-r--r--Zend/tests/bug71336.phpt30
-rw-r--r--Zend/tests/bug71414.phpt1
-rw-r--r--Zend/tests/bug71428.1.phpt3
-rw-r--r--Zend/tests/bug71428.2.phpt4
-rw-r--r--Zend/tests/bug71428.3.phpt2
-rw-r--r--Zend/tests/bug71474.phpt14
-rw-r--r--Zend/tests/bug71539_5.phpt9
-rw-r--r--Zend/tests/bug71572.phpt43
-rw-r--r--Zend/tests/bug71622.phpt22
-rw-r--r--Zend/tests/bug71695.phpt6
-rw-r--r--Zend/tests/bug71756.phpt20
-rw-r--r--Zend/tests/bug71841.phpt50
-rw-r--r--Zend/tests/bug71914.phpt22
-rw-r--r--Zend/tests/bug71930.phpt6
-rw-r--r--Zend/tests/bug72038.phpt27
-rw-r--r--Zend/tests/bug72057.phpt19
-rw-r--r--Zend/tests/bug72101.phpt5
-rw-r--r--Zend/tests/bug72107.phpt12
-rw-r--r--Zend/tests/bug72119.phpt2
-rw-r--r--Zend/tests/bug72162.phpt15
-rw-r--r--Zend/tests/bug72215_2.phpt2
-rw-r--r--Zend/tests/bug72441.phpt4
-rw-r--r--Zend/tests/bug72496.phpt1
-rw-r--r--Zend/tests/bug72508.phpt20
-rw-r--r--Zend/tests/bug72594.phpt14
-rw-r--r--Zend/tests/bug72598.phpt6
-rw-r--r--Zend/tests/bug72598_2.phpt12
-rw-r--r--Zend/tests/bug72911.phpt15
-rw-r--r--Zend/tests/bug72918.phpt2
-rw-r--r--Zend/tests/bug72943.phpt4
-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/bug73288.phpt16
-rw-r--r--Zend/tests/bug73337.phpt5
-rw-r--r--Zend/tests/bug73338.phpt5
-rw-r--r--Zend/tests/bug73663.phpt6
-rw-r--r--Zend/tests/bug73663_2.phpt9
-rw-r--r--Zend/tests/bug73792.phpt6
-rw-r--r--Zend/tests/bug73916.phpt2
-rw-r--r--Zend/tests/bug73954.phpt2
-rw-r--r--Zend/tests/bug73987.phpt2
-rw-r--r--Zend/tests/bug73987_2.phpt2
-rw-r--r--Zend/tests/bug73989.phpt4
-rw-r--r--Zend/tests/bug74053.phpt10
-rw-r--r--Zend/tests/bug74084.phpt32
-rw-r--r--Zend/tests/bug74164.phpt4
-rw-r--r--Zend/tests/bug74340.phpt4
-rw-r--r--Zend/tests/bug74408.phpt34
-rw-r--r--Zend/tests/bug74546.phpt2
-rw-r--r--Zend/tests/bug74657.phpt8
-rw-r--r--Zend/tests/bug74836.phpt4
-rw-r--r--Zend/tests/bug74840.phpt14
-rw-r--r--Zend/tests/bug75241.phpt10
-rw-r--r--Zend/tests/bug75252.phpt4
-rw-r--r--Zend/tests/bug75290.phpt2
-rw-r--r--Zend/tests/bug75420.1.phpt4
-rw-r--r--Zend/tests/bug75420.10.phpt8
-rw-r--r--Zend/tests/bug75420.11.phpt8
-rw-r--r--Zend/tests/bug75420.12.phpt8
-rw-r--r--Zend/tests/bug75420.13.phpt8
-rw-r--r--Zend/tests/bug75420.14.phpt8
-rw-r--r--Zend/tests/bug75420.15.phpt8
-rw-r--r--Zend/tests/bug75420.16.phpt8
-rw-r--r--Zend/tests/bug75420.2.phpt4
-rw-r--r--Zend/tests/bug75420.3.phpt4
-rw-r--r--Zend/tests/bug75420.4.phpt4
-rw-r--r--Zend/tests/bug75420.5.phpt4
-rw-r--r--Zend/tests/bug75420.6.phpt4
-rw-r--r--Zend/tests/bug75420.7.phpt2
-rw-r--r--Zend/tests/bug75420.8.phpt2
-rw-r--r--Zend/tests/bug75420.9.phpt8
-rw-r--r--Zend/tests/bug75420.phpt2
-rw-r--r--Zend/tests/bug75573.phpt62
-rw-r--r--Zend/tests/bug75921.phpt93
-rw-r--r--Zend/tests/bug76025.phpt6
-rw-r--r--Zend/tests/bug76534.phpt8
-rw-r--r--Zend/tests/bug76667.phpt43
-rw-r--r--Zend/tests/bug76754.phpt5
-rw-r--r--Zend/tests/bug76800.phpt1
-rw-r--r--Zend/tests/bug76846.phpt2
-rw-r--r--Zend/tests/bug76860.phpt8
-rw-r--r--Zend/tests/bug76860_2.phpt8
-rw-r--r--Zend/tests/bug76869.phpt20
-rw-r--r--Zend/tests/bug76965.phpt10
-rw-r--r--Zend/tests/bug77291.phpt2
-rw-r--r--Zend/tests/bug77339.phpt2
-rw-r--r--Zend/tests/bug77345_gc_1.phpt3
-rw-r--r--Zend/tests/bug77345_gc_2.phpt3
-rw-r--r--Zend/tests/bug77494.phpt2
-rw-r--r--Zend/tests/bug77589.phpt4
-rw-r--r--Zend/tests/bug77738.phpt6
-rw-r--r--Zend/tests/bug77877.phpt14
-rw-r--r--Zend/tests/bug77966.phpt25
-rw-r--r--Zend/tests/bug77993.phpt3
-rw-r--r--Zend/tests/bug78154.phpt27
-rw-r--r--Zend/tests/bug78182.phpt15
-rw-r--r--Zend/tests/bug78239.phpt17
-rw-r--r--Zend/tests/bug78344.phpt2
-rw-r--r--Zend/tests/bug78379.phpt8
-rw-r--r--Zend/tests/bug78379_2.phpt12
-rw-r--r--Zend/tests/bug78396.phpt2
-rw-r--r--Zend/tests/bug78454_1.phpt2
-rw-r--r--Zend/tests/bug78454_2.phpt2
-rw-r--r--Zend/tests/bug78531.phpt45
-rw-r--r--Zend/tests/bug78658.phpt2
-rw-r--r--Zend/tests/bug78770.phpt25
-rw-r--r--Zend/tests/bug78868.phpt20
-rw-r--r--Zend/tests/bug78898.phpt28
-rw-r--r--Zend/tests/bug78926.phpt2
-rw-r--r--Zend/tests/bug78999.phpt7
-rw-r--r--Zend/tests/bug79022.phpt36
-rw-r--r--Zend/tests/bug79108.phpt21
-rw-r--r--Zend/tests/bug79155.phpt4
-rw-r--r--Zend/tests/bug79382.phpt16
-rw-r--r--Zend/tests/bug79477.phpt2
-rw-r--r--Zend/tests/bug79599.phpt18
-rw-r--r--Zend/tests/bug79740.phpt22
-rw-r--r--Zend/tests/bug79783.phpt2
-rw-r--r--Zend/tests/bug79790.phpt15
-rw-r--r--Zend/tests/bug79791.phpt12
-rw-r--r--Zend/tests/bug79792.phpt2
-rw-r--r--Zend/tests/bug79793.phpt4
-rw-r--r--Zend/tests/bug79818.phpt15
-rw-r--r--Zend/tests/bug79828.phpt17
-rw-r--r--Zend/tests/bug79897.phpt38
-rw-r--r--Zend/tests/bug79900.phpt13
-rw-r--r--Zend/tests/bug79927.phpt31
-rw-r--r--Zend/tests/bug79947.phpt10
-rw-r--r--Zend/tests/bug79948.inc2
-rw-r--r--Zend/tests/bug79948.phpt10
-rw-r--r--Zend/tests/bug79979.phpt19
-rw-r--r--Zend/tests/bug80030.phpt19
-rw-r--r--Zend/tests/bug80037.phpt26
-rw-r--r--Zend/tests/bug80045.phpt22
-rw-r--r--Zend/tests/bug80055.phpt24
-rw-r--r--Zend/tests/bug80096.phpt14
-rw-r--r--Zend/tests/bug80184.phpt20
-rw-r--r--Zend/tests/bug80255.phpt24
-rw-r--r--Zend/tests/bug80391.phpt23
-rw-r--r--Zend/tests/bug80404.phpt11
-rw-r--r--Zend/tests/bug80781.phpt5
-rw-r--r--Zend/tests/bug80811.phpt19
-rw-r--r--Zend/tests/bug_debug_backtrace.phpt2
-rw-r--r--Zend/tests/call_static.phpt9
-rw-r--r--Zend/tests/call_static_002.phpt16
-rw-r--r--Zend/tests/call_static_003.phpt26
-rw-r--r--Zend/tests/call_static_004.phpt8
-rw-r--r--Zend/tests/call_static_006.phpt20
-rw-r--r--Zend/tests/call_static_007.phpt18
-rw-r--r--Zend/tests/call_to_deprecated_function_args.phpt19
-rw-r--r--Zend/tests/call_user_func_001.phpt50
-rw-r--r--Zend/tests/call_user_func_002.phpt42
-rw-r--r--Zend/tests/call_user_func_003.phpt14
-rw-r--r--Zend/tests/call_user_func_004.phpt22
-rw-r--r--Zend/tests/call_user_func_005.phpt16
-rw-r--r--Zend/tests/call_user_func_006.phpt4
-rw-r--r--Zend/tests/call_user_func_007.phpt6
-rw-r--r--Zend/tests/call_user_func_008.phpt16
-rw-r--r--Zend/tests/call_user_func_009.phpt4
-rw-r--r--Zend/tests/call_user_func_array_array_slice_named_args.phpt8
-rw-r--r--Zend/tests/call_user_func_array_invalid_type.phpt18
-rw-r--r--Zend/tests/case_insensitive_constant_deprecation.phpt131
-rw-r--r--Zend/tests/cast_to_array.phptbin985 -> 1051 bytes
-rw-r--r--Zend/tests/cast_to_bool.phpt36
-rw-r--r--Zend/tests/cast_to_double.phpt40
-rw-r--r--Zend/tests/cast_to_int.phpt38
-rw-r--r--Zend/tests/cast_to_object.phptbin1110 -> 1167 bytes
-rw-r--r--Zend/tests/cast_to_string.phptbin719 -> 784 bytes
-rw-r--r--Zend/tests/catch.phpt8
-rw-r--r--Zend/tests/catch_static.phpt17
-rw-r--r--Zend/tests/class_alias_005.phpt12
-rw-r--r--Zend/tests/class_alias_006.phpt10
-rw-r--r--Zend/tests/class_alias_007.phpt2
-rw-r--r--Zend/tests/class_alias_011.phpt12
-rw-r--r--Zend/tests/class_alias_014.phpt2
-rw-r--r--Zend/tests/class_alias_016.phpt2
-rw-r--r--Zend/tests/class_alias_017.phpt12
-rw-r--r--Zend/tests/class_alias_020.phpt2
-rw-r--r--Zend/tests/class_constants_001.phpt6
-rw-r--r--Zend/tests/class_constants_002.phpt8
-rw-r--r--Zend/tests/class_constants_003.phpt4
-rw-r--r--Zend/tests/class_constants_004.phpt22
-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_name_as_scalar_error_005.phpt2
-rw-r--r--Zend/tests/class_name_as_scalar_error_006.phpt2
-rw-r--r--Zend/tests/class_name_as_scalar_error_007.phpt4
-rw-r--r--Zend/tests/class_name_of_var.phpt11
-rw-r--r--Zend/tests/class_on_constant_evaluated_expression.phpt10
-rw-r--r--Zend/tests/class_on_expression_in_constant_expression.phpt10
-rw-r--r--Zend/tests/class_on_object.phpt28
-rw-r--r--Zend/tests/class_properties_const.phpt6
-rw-r--r--Zend/tests/class_properties_dynamic.phpt6
-rw-r--r--Zend/tests/class_properties_static.phpt12
-rw-r--r--Zend/tests/class_uses_static.phpt12
-rw-r--r--Zend/tests/clone_003.phpt2
-rw-r--r--Zend/tests/clone_004.phpt6
-rw-r--r--Zend/tests/closure_001.phpt4
-rw-r--r--Zend/tests/closure_002.phpt4
-rw-r--r--Zend/tests/closure_003.phpt24
-rw-r--r--Zend/tests/closure_004.phpt18
-rw-r--r--Zend/tests/closure_005.phpt62
-rw-r--r--Zend/tests/closure_006.phpt6
-rw-r--r--Zend/tests/closure_007.phpt22
-rw-r--r--Zend/tests/closure_008.phpt8
-rw-r--r--Zend/tests/closure_012.phpt4
-rw-r--r--Zend/tests/closure_013.phpt12
-rw-r--r--Zend/tests/closure_014.phpt20
-rw-r--r--Zend/tests/closure_016.phpt12
-rw-r--r--Zend/tests/closure_018.phpt14
-rw-r--r--Zend/tests/closure_019.phpt14
-rw-r--r--Zend/tests/closure_020.phpt18
-rw-r--r--Zend/tests/closure_021.phpt14
-rw-r--r--Zend/tests/closure_023.phpt1
-rw-r--r--Zend/tests/closure_025.phpt13
-rw-r--r--Zend/tests/closure_026.phpt25
-rw-r--r--Zend/tests/closure_027.phpt12
-rw-r--r--Zend/tests/closure_028.phpt2
-rw-r--r--Zend/tests/closure_031.phpt6
-rw-r--r--Zend/tests/closure_033.phpt20
-rw-r--r--Zend/tests/closure_034.phpt2
-rw-r--r--Zend/tests/closure_035.phpt10
-rw-r--r--Zend/tests/closure_036.phpt14
-rw-r--r--Zend/tests/closure_037.phpt36
-rw-r--r--Zend/tests/closure_038.phpt24
-rw-r--r--Zend/tests/closure_039.phpt24
-rw-r--r--Zend/tests/closure_040.phpt46
-rw-r--r--Zend/tests/closure_041.phpt45
-rw-r--r--Zend/tests/closure_043.phpt9
-rw-r--r--Zend/tests/closure_044.phpt23
-rw-r--r--Zend/tests/closure_045.phpt1
-rw-r--r--Zend/tests/closure_046.phpt18
-rw-r--r--Zend/tests/closure_047.phpt8
-rw-r--r--Zend/tests/closure_048.phpt10
-rw-r--r--Zend/tests/closure_049.phpt1
-rw-r--r--Zend/tests/closure_050.phpt1
-rw-r--r--Zend/tests/closure_051.phpt1
-rw-r--r--Zend/tests/closure_052.phpt1
-rw-r--r--Zend/tests/closure_053.phpt1
-rw-r--r--Zend/tests/closure_054.phpt1
-rw-r--r--Zend/tests/closure_055.phpt1
-rw-r--r--Zend/tests/closure_056.phpt1
-rw-r--r--Zend/tests/closure_057.phpt12
-rw-r--r--Zend/tests/closure_058.phpt13
-rw-r--r--Zend/tests/closure_059.phpt19
-rw-r--r--Zend/tests/closure_060.phpt12
-rw-r--r--Zend/tests/closure_061.phpt8
-rw-r--r--Zend/tests/closure_062.phpt2
-rw-r--r--Zend/tests/closure_bug66622.phpt1
-rw-r--r--Zend/tests/closure_call_leak_with_exception.phpt4
-rw-r--r--Zend/tests/closure_invoke_ref_warning.phpt13
-rw-r--r--Zend/tests/closure_use_trailing_comma.phpt17
-rw-r--r--Zend/tests/closures/closure_from_callable.inc250
-rw-r--r--Zend/tests/closures/closure_from_callable_basic.phpt12
-rw-r--r--Zend/tests/closures/closure_from_callable_error.phpt128
-rw-r--r--Zend/tests/closures/closure_from_callable_non_static_statically.phpt2
-rw-r--r--Zend/tests/closures/closure_from_callable_reflection.phpt28
-rw-r--r--Zend/tests/closures/closure_instantiate.phpt4
-rw-r--r--Zend/tests/compare_001.phpt62
-rw-r--r--Zend/tests/compare_001_64bit.phpt62
-rw-r--r--Zend/tests/compare_002.phpt54
-rw-r--r--Zend/tests/compare_002_64bit.phpt54
-rw-r--r--Zend/tests/compare_003.phpt70
-rw-r--r--Zend/tests/compare_003_64bit.phpt70
-rw-r--r--Zend/tests/compare_004.phpt70
-rw-r--r--Zend/tests/compare_004_64bit.phpt70
-rw-r--r--Zend/tests/compare_005.phpt70
-rw-r--r--Zend/tests/compare_005_64bit.phpt70
-rw-r--r--Zend/tests/compare_006.phpt70
-rw-r--r--Zend/tests/compare_006_64bit.phpt70
-rw-r--r--Zend/tests/compound_assign_failure.phpt131
-rw-r--r--Zend/tests/compound_assign_with_numeric_strings.phpt7
-rw-r--r--Zend/tests/concat_001.phpt26
-rw-r--r--Zend/tests/const_array_with_resource_key.phpt2
-rw-r--r--Zend/tests/const_deprecation.phpt25
-rw-r--r--Zend/tests/const_dereference_001.phpt2
-rw-r--r--Zend/tests/const_dereference_002.phpt7
-rw-r--r--Zend/tests/const_dereference_003.phpt2
-rw-r--r--Zend/tests/constant_arrays.phpt22
-rw-r--r--Zend/tests/constant_expressions_arrays.phpt6
-rw-r--r--Zend/tests/constant_expressions_classes.phpt16
-rw-r--r--Zend/tests/constant_expressions_coalesce.phpt26
-rw-r--r--Zend/tests/constant_expressions_dynamic.phpt2
-rw-r--r--Zend/tests/constant_expressions_exceptions_001.phpt6
-rw-r--r--Zend/tests/constant_expressions_exceptions_002.phpt7
-rw-r--r--Zend/tests/constant_expressions_invalid_offset_type_error.phpt2
-rw-r--r--Zend/tests/constant_expressions_self_referencing_array.phpt2
-rw-r--r--Zend/tests/constants_001.phpt2
-rw-r--r--Zend/tests/constants_002.phpt23
-rw-r--r--Zend/tests/constants_004.phpt2
-rw-r--r--Zend/tests/constants_005.phpt7
-rw-r--r--Zend/tests/constants_006.phpt10
-rw-r--r--Zend/tests/constants_007.phpt4
-rw-r--r--Zend/tests/constants_008.phpt4
-rw-r--r--Zend/tests/constants_009.phpt2
-rw-r--r--Zend/tests/continue_targeting_switch_warning.phpt21
-rw-r--r--Zend/tests/ctor_promotion_abstract.phpt12
-rw-r--r--Zend/tests/ctor_promotion_additional_modifiers.phpt12
-rw-r--r--Zend/tests/ctor_promotion_attributes.phpt22
-rw-r--r--Zend/tests/ctor_promotion_basic.phpt21
-rw-r--r--Zend/tests/ctor_promotion_by_ref.phpt20
-rw-r--r--Zend/tests/ctor_promotion_callable_type.phpt12
-rw-r--r--Zend/tests/ctor_promotion_defaults.phpt43
-rw-r--r--Zend/tests/ctor_promotion_free_function.phpt10
-rw-r--r--Zend/tests/ctor_promotion_interface.phpt12
-rw-r--r--Zend/tests/ctor_promotion_mixing.phpt54
-rw-r--r--Zend/tests/ctor_promotion_not_a_ctor.phpt12
-rw-r--r--Zend/tests/ctor_promotion_null_default.phpt12
-rw-r--r--Zend/tests/ctor_promotion_repeated_prop.phpt14
-rw-r--r--Zend/tests/ctor_promotion_trait.phpt21
-rw-r--r--Zend/tests/ctor_promotion_untyped_default.phpt29
-rw-r--r--Zend/tests/ctor_promotion_variadic.phpt12
-rw-r--r--Zend/tests/custom_assert_forbidden.phpt (renamed from Zend/tests/custom_assert_deprecation.phpt)2
-rw-r--r--Zend/tests/dead_array_type_inference.phpt4
-rw-r--r--Zend/tests/debug_backtrace_options.phpt52
-rw-r--r--Zend/tests/debug_backtrace_with_include_and_this.phpt3
-rw-r--r--Zend/tests/debug_info-error-0.0.phpt1
-rw-r--r--Zend/tests/debug_info-error-0.phpt1
-rw-r--r--Zend/tests/debug_info-error-1.0.phpt1
-rw-r--r--Zend/tests/debug_info-error-1.phpt1
-rw-r--r--Zend/tests/debug_info-error-empty_str.phpt1
-rw-r--r--Zend/tests/debug_info-error-false.phpt1
-rw-r--r--Zend/tests/debug_info-error-object.phpt1
-rw-r--r--Zend/tests/debug_info-error-resource.phpt1
-rw-r--r--Zend/tests/debug_info-error-str.phpt1
-rw-r--r--Zend/tests/debug_info-error-true.phpt1
-rw-r--r--Zend/tests/debug_info.phpt1
-rw-r--r--Zend/tests/declare_006.phpt1
-rw-r--r--Zend/tests/decrement_001.phpt41
-rw-r--r--Zend/tests/decrement_001_64bit.phpt49
-rw-r--r--Zend/tests/defined_fn_no_ns_fallback.phpt16
-rw-r--r--Zend/tests/dereference_001.phpt28
-rw-r--r--Zend/tests/dereference_002.phpt20
-rw-r--r--Zend/tests/dereference_003.phpt36
-rw-r--r--Zend/tests/dereference_004.phpt18
-rw-r--r--Zend/tests/dereference_005.phpt2
-rw-r--r--Zend/tests/dereference_006.phpt2
-rw-r--r--Zend/tests/dereference_007.phpt20
-rw-r--r--Zend/tests/dereference_008.phpt8
-rw-r--r--Zend/tests/dereference_009.phpt2
-rw-r--r--Zend/tests/dereference_010.phpt8
-rw-r--r--Zend/tests/dereference_011.phpt8
-rw-r--r--Zend/tests/dereference_012.phpt24
-rw-r--r--Zend/tests/dereference_013.phpt18
-rw-r--r--Zend/tests/dereference_014.phpt24
-rw-r--r--Zend/tests/die_string_cast_exception.phpt13
-rw-r--r--Zend/tests/dim_assign_001.phpt24
-rw-r--r--Zend/tests/dim_assign_001.txt2
-rw-r--r--Zend/tests/div_001.phpt6
-rw-r--r--Zend/tests/div_002.phpt8
-rw-r--r--Zend/tests/div_by_zero_in_static.phpt11
-rw-r--r--Zend/tests/double_to_string.phpt36
-rw-r--r--Zend/tests/dval_to_lval_32.phpt28
-rw-r--r--Zend/tests/dval_to_lval_64.phpt24
-rw-r--r--Zend/tests/dynamic_call_001.phpt22
-rw-r--r--Zend/tests/dynamic_call_002.phpt2
-rw-r--r--Zend/tests/dynamic_call_003.phpt2
-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/dynamic_call_freeing.phpt4
-rw-r--r--Zend/tests/dynamic_call_non_static.phpt30
-rw-r--r--Zend/tests/dynamic_prop_name_leak.phpt14
-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/empty_with_expr.phpt1
-rw-r--r--Zend/tests/entry_block_with_predecessors.phpt2
-rw-r--r--Zend/tests/errmsg_001.phpt2
-rw-r--r--Zend/tests/errmsg_002.phpt4
-rw-r--r--Zend/tests/errmsg_003.phpt8
-rw-r--r--Zend/tests/errmsg_004.phpt2
-rw-r--r--Zend/tests/errmsg_005.phpt6
-rw-r--r--Zend/tests/errmsg_009.phpt2
-rw-r--r--Zend/tests/errmsg_010.phpt2
-rw-r--r--Zend/tests/errmsg_011.phpt4
-rw-r--r--Zend/tests/errmsg_012.phpt11
-rw-r--r--Zend/tests/errmsg_013.phpt8
-rw-r--r--Zend/tests/errmsg_015.phpt6
-rw-r--r--Zend/tests/errmsg_016.phpt4
-rw-r--r--Zend/tests/errmsg_017.phpt4
-rw-r--r--Zend/tests/errmsg_018.phpt2
-rw-r--r--Zend/tests/errmsg_019.phpt6
-rw-r--r--Zend/tests/errmsg_020.phpt12
-rw-r--r--Zend/tests/errmsg_022.phpt5
-rw-r--r--Zend/tests/errmsg_023.phpt4
-rw-r--r--Zend/tests/errmsg_024.phpt4
-rw-r--r--Zend/tests/errmsg_025.phpt4
-rw-r--r--Zend/tests/errmsg_027.phpt8
-rw-r--r--Zend/tests/errmsg_030.phpt2
-rw-r--r--Zend/tests/errmsg_031.phpt2
-rw-r--r--Zend/tests/errmsg_032.phpt6
-rw-r--r--Zend/tests/errmsg_033.phpt6
-rw-r--r--Zend/tests/errmsg_034.phpt6
-rw-r--r--Zend/tests/errmsg_035.phpt2
-rw-r--r--Zend/tests/errmsg_036.phpt2
-rw-r--r--Zend/tests/errmsg_037.phpt2
-rw-r--r--Zend/tests/errmsg_038.phpt2
-rw-r--r--Zend/tests/errmsg_039.phpt4
-rw-r--r--Zend/tests/errmsg_040.phpt2
-rw-r--r--Zend/tests/errmsg_045.phpt10
-rw-r--r--Zend/tests/error_reporting01.phpt4
-rw-r--r--Zend/tests/error_reporting02.phpt6
-rw-r--r--Zend/tests/error_reporting03.phpt16
-rw-r--r--Zend/tests/error_reporting04.phpt6
-rw-r--r--Zend/tests/error_reporting05.phpt16
-rw-r--r--Zend/tests/error_reporting06.phpt6
-rw-r--r--Zend/tests/error_reporting07.phpt6
-rw-r--r--Zend/tests/error_reporting08.phpt10
-rw-r--r--Zend/tests/error_reporting09.phpt16
-rw-r--r--Zend/tests/error_reporting10.phpt11
-rw-r--r--Zend/tests/eval_parse_error_with_doc_comment.phpt2
-rw-r--r--Zend/tests/exception_001.phpt36
-rw-r--r--Zend/tests/exception_002.phpt6
-rw-r--r--Zend/tests/exception_004.phpt4
-rw-r--r--Zend/tests/exception_007.phpt14
-rw-r--r--Zend/tests/exception_008.phpt12
-rw-r--r--Zend/tests/exception_012.phpt23
-rw-r--r--Zend/tests/exception_013.phpt18
-rw-r--r--Zend/tests/exception_014.phpt6
-rw-r--r--Zend/tests/exception_015.phpt4
-rw-r--r--Zend/tests/exception_016.phpt4
-rw-r--r--Zend/tests/exception_017.phpt28
-rw-r--r--Zend/tests/exception_018.phpt2
-rw-r--r--Zend/tests/exception_019.phpt2
-rw-r--r--Zend/tests/exception_020.phpt2
-rw-r--r--Zend/tests/exception_021.phpt2
-rw-r--r--Zend/tests/exception_022.phpt2
-rw-r--r--Zend/tests/exception_023.phpt2
-rw-r--r--Zend/tests/exception_024.phpt19
-rw-r--r--Zend/tests/exception_025.phpt41
-rw-r--r--Zend/tests/exception_before_fatal.phpt14
-rw-r--r--Zend/tests/exception_delayed_message.phpt41
-rw-r--r--Zend/tests/exception_from_toString.phpt2
-rw-r--r--Zend/tests/exception_handler_001.phpt2
-rw-r--r--Zend/tests/exception_handler_002.phpt4
-rw-r--r--Zend/tests/exception_handler_003.phpt12
-rw-r--r--Zend/tests/exception_handler_004.phpt27
-rw-r--r--Zend/tests/exception_handler_005.phpt4
-rw-r--r--Zend/tests/exception_handler_006.phpt4
-rw-r--r--Zend/tests/exception_handler_007.phpt26
-rw-r--r--Zend/tests/exit_exception_handler.phpt14
-rw-r--r--Zend/tests/exit_finally_1.phpt19
-rw-r--r--Zend/tests/exit_finally_2.phpt23
-rw-r--r--Zend/tests/exit_finally_3.phpt19
-rw-r--r--Zend/tests/flexible-heredoc-error7.phpt2
-rw-r--r--Zend/tests/flexible-nowdoc-error7.phpt2
-rw-r--r--Zend/tests/flexible-nowdoc-error8.phpt2
-rw-r--r--Zend/tests/foreach.phpt10
-rw-r--r--Zend/tests/foreach_002.phpt7
-rw-r--r--Zend/tests/foreach_003.phpt50
-rw-r--r--Zend/tests/foreach_004.phpt50
-rw-r--r--Zend/tests/foreach_005.phpt8
-rw-r--r--Zend/tests/foreach_006.phpt6
-rw-r--r--Zend/tests/foreach_007.phpt4
-rw-r--r--Zend/tests/foreach_008.phpt14
-rw-r--r--Zend/tests/foreach_009.phpt12
-rw-r--r--Zend/tests/foreach_010.phpt12
-rw-r--r--Zend/tests/foreach_011.phpt8
-rw-r--r--Zend/tests/foreach_012.phpt8
-rw-r--r--Zend/tests/foreach_013.phpt8
-rw-r--r--Zend/tests/foreach_014.phpt8
-rw-r--r--Zend/tests/foreach_015.phpt4
-rw-r--r--Zend/tests/foreach_016.phpt8
-rw-r--r--Zend/tests/foreach_017.phpt60
-rw-r--r--Zend/tests/foreach_over_null.phpt15
-rw-r--r--Zend/tests/foreach_shadowed_dyn_property.phpt2
-rw-r--r--Zend/tests/foreach_undefined.phpt4
-rw-r--r--Zend/tests/foreach_unset_globals.phpt2
-rw-r--r--Zend/tests/fr47160.phpt60
-rw-r--r--Zend/tests/func_get_args.phpt12
-rw-r--r--Zend/tests/func_sig_trailing_comma.phpt46
-rw-r--r--Zend/tests/function_arguments/argument_count_correct.phpt1
-rw-r--r--Zend/tests/function_arguments/argument_count_correct_strict.phpt1
-rw-r--r--Zend/tests/function_arguments/argument_count_incorrect_internal.phpt14
-rw-r--r--Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt24
-rw-r--r--Zend/tests/function_arguments/argument_count_incorrect_userland.phpt29
-rw-r--r--Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt39
-rw-r--r--Zend/tests/function_arguments/call_with_leading_comma_error.phpt2
-rw-r--r--Zend/tests/function_arguments/call_with_multi_inner_comma_error.phpt2
-rw-r--r--Zend/tests/function_arguments/call_with_multi_trailing_comma_error.phpt2
-rw-r--r--Zend/tests/function_arguments/call_with_only_comma_error.phpt2
-rw-r--r--Zend/tests/function_arguments/variadic_argument_type_error.phpt23
-rw-r--r--Zend/tests/function_arguments_003.phpt2
-rw-r--r--Zend/tests/function_exists_basic.phpt5
-rw-r--r--Zend/tests/function_outside_namespace.phpt12
-rw-r--r--Zend/tests/gc_004.phpt5
-rw-r--r--Zend/tests/gc_007.phpt5
-rw-r--r--Zend/tests/gc_010.phpt5
-rw-r--r--Zend/tests/gc_011.phpt8
-rw-r--r--Zend/tests/gc_012.phpt5
-rw-r--r--Zend/tests/gc_013.phpt2
-rw-r--r--Zend/tests/gc_014.phpt4
-rw-r--r--Zend/tests/gc_016.phpt16
-rw-r--r--Zend/tests/gc_017.phpt34
-rw-r--r--Zend/tests/gc_023.phpt9
-rw-r--r--Zend/tests/gc_027.phpt5
-rw-r--r--Zend/tests/gc_028.phpt14
-rw-r--r--Zend/tests/gc_029.phpt18
-rw-r--r--Zend/tests/gc_033.phpt6
-rw-r--r--Zend/tests/gc_035.phpt11
-rw-r--r--Zend/tests/gc_036.phpt8
-rw-r--r--Zend/tests/gc_037.phpt1
-rw-r--r--Zend/tests/gc_038.phpt150
-rw-r--r--Zend/tests/gc_041.phpt6
-rw-r--r--Zend/tests/gc_043.phpt44
-rw-r--r--Zend/tests/generators/backtrace_multi_yield_from.phpt32
-rw-r--r--Zend/tests/generators/basic_yield_from_exception_handling.phpt28
-rw-r--r--Zend/tests/generators/basic_yield_from_proxying.phpt14
-rw-r--r--Zend/tests/generators/bug63066.phpt9
-rw-r--r--Zend/tests/generators/bug65161.phpt7
-rw-r--r--Zend/tests/generators/bug67497.phpt2
-rw-r--r--Zend/tests/generators/bug70904.phpt8
-rw-r--r--Zend/tests/generators/bug71297.phpt14
-rw-r--r--Zend/tests/generators/bug71441.phpt14
-rw-r--r--Zend/tests/generators/bug71601.phpt26
-rw-r--r--Zend/tests/generators/bug72523.phpt6
-rw-r--r--Zend/tests/generators/bug74157.phpt12
-rw-r--r--Zend/tests/generators/bug74606.phpt28
-rw-r--r--Zend/tests/generators/bug76427.phpt2
-rw-r--r--Zend/tests/generators/bug80240.phpt28
-rw-r--r--Zend/tests/generators/dynamic_properties.phpt19
-rw-r--r--Zend/tests/generators/errors/count_error.phpt8
-rw-r--r--Zend/tests/generators/errors/resume_running_generator_error.phpt10
-rw-r--r--Zend/tests/generators/finally/return_yield.phpt1
-rw-r--r--Zend/tests/generators/finally/throw_yield.phpt1
-rw-r--r--Zend/tests/generators/finally/yield_return.phpt1
-rw-r--r--Zend/tests/generators/finally/yield_throw.phpt1
-rw-r--r--Zend/tests/generators/finally/yield_yield.phpt1
-rw-r--r--Zend/tests/generators/gc_with_yield_from.phpt16
-rw-r--r--Zend/tests/generators/generator_return_return_type.phpt6
-rw-r--r--Zend/tests/generators/generator_return_without_value.phpt4
-rw-r--r--Zend/tests/generators/generator_returns_generator.phpt2
-rw-r--r--Zend/tests/generators/generator_symtable_leak.phpt8
-rw-r--r--Zend/tests/generators/generator_with_type_check.phpt2
-rw-r--r--Zend/tests/generators/generator_with_type_check_2.phpt14
-rw-r--r--Zend/tests/generators/iterator_wrapper_leak.phpt33
-rw-r--r--Zend/tests/generators/multiple_yield_from_on_same_generator.phpt22
-rw-r--r--Zend/tests/generators/mutli_yield_from_with_exception.phpt22
-rw-r--r--Zend/tests/generators/no_foreach_var_leaks.phpt6
-rw-r--r--Zend/tests/generators/recursive_yield_from.phpt16
-rw-r--r--Zend/tests/generators/repeated_yield_from_with_immediate_release.phpt19
-rw-r--r--Zend/tests/generators/throw_into_yield_from_array.phpt22
-rw-r--r--Zend/tests/generators/throw_not_an_exception.phpt7
-rw-r--r--Zend/tests/generators/xrange.phpt8
-rw-r--r--Zend/tests/generators/yield_during_function_call.phpt2
-rw-r--r--Zend/tests/generators/yield_from_aborted_generator_with_children.phpt31
-rw-r--r--Zend/tests/generators/yield_from_already_running.phpt2
-rw-r--r--Zend/tests/generators/yield_from_array.phpt10
-rw-r--r--Zend/tests/generators/yield_from_backtrace.phpt18
-rw-r--r--Zend/tests/generators/yield_from_chain_dtor_order.phpt24
-rw-r--r--Zend/tests/generators/yield_from_deep_recursion.phpt16
-rw-r--r--Zend/tests/generators/yield_from_greedy_parse.phpt1
-rw-r--r--Zend/tests/generators/yield_from_iterator.phpt8
-rw-r--r--Zend/tests/generators/yield_from_multi_tree.phpt44
-rw-r--r--Zend/tests/generators/yield_from_multi_tree_exception.phpt44
-rw-r--r--Zend/tests/generators/yield_from_multi_tree_single_nodes.phpt328
-rw-r--r--Zend/tests/generators/yield_unary_precedence.phpt10
-rw-r--r--Zend/tests/get_called_class_001.phpt11
-rw-r--r--Zend/tests/get_class_methods_001.phpt16
-rw-r--r--Zend/tests/get_class_methods_002.phpt18
-rw-r--r--Zend/tests/get_class_methods_003.phpt36
-rw-r--r--Zend/tests/get_class_vars_001.phpt19
-rw-r--r--Zend/tests/get_class_vars_002.phpt26
-rw-r--r--Zend/tests/get_class_vars_003.phpt30
-rw-r--r--Zend/tests/get_class_vars_004.phpt24
-rw-r--r--Zend/tests/get_class_vars_005.phpt14
-rw-r--r--Zend/tests/get_class_vars_006.phpt12
-rw-r--r--Zend/tests/get_class_vars_007.phpt12
-rw-r--r--Zend/tests/get_defined_functions_basic.phpt27
-rw-r--r--Zend/tests/get_defined_vars.phpt4
-rw-r--r--Zend/tests/get_parent_class_001.phpt14
-rw-r--r--Zend/tests/get_resource_id.phpt18
-rw-r--r--Zend/tests/globals_001.phpt4
-rw-r--r--Zend/tests/globals_002.phpt22
-rw-r--r--Zend/tests/globals_003.phpt26
-rw-r--r--Zend/tests/globals_004.phpt6
-rw-r--r--Zend/tests/grammar/regression_001.phpt7
-rw-r--r--Zend/tests/grammar/regression_002.phpt1
-rw-r--r--Zend/tests/grammar/regression_004.phpt3
-rw-r--r--Zend/tests/grammar/regression_005.phpt3
-rw-r--r--Zend/tests/grammar/regression_006.phpt1
-rw-r--r--Zend/tests/grammar/regression_007.phpt1
-rw-r--r--Zend/tests/grammar/regression_008.phpt1
-rw-r--r--Zend/tests/grammar/regression_009.phpt1
-rw-r--r--Zend/tests/grammar/regression_010.phpt7
-rw-r--r--Zend/tests/grammar/regression_012.phpt2
-rw-r--r--Zend/tests/grammar/semi_reserved_001.phpt1
-rw-r--r--Zend/tests/grammar/semi_reserved_002.phpt1
-rw-r--r--Zend/tests/grammar/semi_reserved_004.phpt1
-rw-r--r--Zend/tests/grammar/semi_reserved_005.phpt1
-rw-r--r--Zend/tests/grammar/semi_reserved_006.phpt1
-rw-r--r--Zend/tests/grammar/semi_reserved_007.phpt1
-rw-r--r--Zend/tests/grammar/semi_reserved_008.phpt1
-rw-r--r--Zend/tests/grammar/semi_reserved_009.phpt1
-rw-r--r--Zend/tests/grammar/semi_reserved_010.phpt1
-rw-r--r--Zend/tests/grandparent_prototype.phpt2
-rw-r--r--Zend/tests/halt01.phpt1
-rw-r--r--Zend/tests/halt03.phpt3
-rw-r--r--Zend/tests/halt_compiler2.phpt2
-rw-r--r--Zend/tests/halt_compiler3.phpt4
-rw-r--r--Zend/tests/halt_compiler4.phpt2
-rw-r--r--Zend/tests/halt_compiler5.phpt6
-rw-r--r--Zend/tests/hex_overflow_32bit.phpt16
-rw-r--r--Zend/tests/illegal_offset_unset_isset_empty.phpt27
-rw-r--r--Zend/tests/include_stat_is_quiet.phpt7
-rw-r--r--Zend/tests/incompat_ctx_user.phpt13
-rw-r--r--Zend/tests/increment_001.phpt41
-rw-r--r--Zend/tests/indexing_001.phpt98
-rw-r--r--Zend/tests/indirect_call_array_001.phpt2
-rw-r--r--Zend/tests/indirect_call_array_003.phpt24
-rw-r--r--Zend/tests/indirect_call_array_004.phpt38
-rw-r--r--Zend/tests/indirect_call_array_005.phpt7
-rw-r--r--Zend/tests/indirect_call_string_002.phpt8
-rw-r--r--Zend/tests/indirect_call_string_003.phpt7
-rw-r--r--Zend/tests/indirect_method_call_001.phpt10
-rw-r--r--Zend/tests/indirect_method_call_002.phpt18
-rw-r--r--Zend/tests/indirect_method_call_003.phpt16
-rw-r--r--Zend/tests/indirect_method_call_004.phpt14
-rw-r--r--Zend/tests/indirect_method_call_005.phpt6
-rw-r--r--Zend/tests/indirect_property_access.phpt4
-rw-r--r--Zend/tests/inference_infinite_loop.phpt2
-rw-r--r--Zend/tests/instanceof.phpt6
-rw-r--r--Zend/tests/instanceof_001.phpt6
-rw-r--r--Zend/tests/instantiate_all_classes.phpt15
-rw-r--r--Zend/tests/int_conversion_exponents.phpt8
-rw-r--r--Zend/tests/int_overflow_32bit.phpt16
-rw-r--r--Zend/tests/int_static_prop_name.phpt6
-rw-r--r--Zend/tests/int_underflow_32bit.phpt16
-rw-r--r--Zend/tests/inter_007.phpt4
-rw-r--r--Zend/tests/inter_03.phpt4
-rw-r--r--Zend/tests/inter_04.phpt4
-rw-r--r--Zend/tests/interface_exists_001.phpt6
-rw-r--r--Zend/tests/interface_extends_static.phpt10
-rw-r--r--Zend/tests/invalid_parent_const_ref_leak.phpt2
-rw-r--r--Zend/tests/is_a.phpt6
-rw-r--r--Zend/tests/isset_001.phpt4
-rw-r--r--Zend/tests/isset_003.phpt10
-rw-r--r--Zend/tests/isset_array.phpt48
-rw-r--r--Zend/tests/iterable_or_null.phpt49
-rw-r--r--Zend/tests/jump03.phpt14
-rw-r--r--Zend/tests/jump04.phpt18
-rw-r--r--Zend/tests/jump05.phpt22
-rw-r--r--Zend/tests/jump07.phpt2
-rw-r--r--Zend/tests/jump08.phpt2
-rw-r--r--Zend/tests/jump09.phpt6
-rw-r--r--Zend/tests/jump10.phpt6
-rw-r--r--Zend/tests/jump14.phpt16
-rw-r--r--Zend/tests/jump15.phpt24
-rw-r--r--Zend/tests/jump16.phpt16
-rw-r--r--Zend/tests/jump17.phpt15
-rw-r--r--Zend/tests/lc_ctype_inheritance.phpt25
-rw-r--r--Zend/tests/list/list_reference_006.phpt2
-rw-r--r--Zend/tests/list_006.phpt4
-rw-r--r--Zend/tests/list_011.phpt2
-rw-r--r--Zend/tests/list_keyed_conversions.phpt4
-rw-r--r--Zend/tests/list_keyed_evaluation_order.inc2
-rw-r--r--Zend/tests/list_keyed_evaluation_order.phpt4
-rw-r--r--Zend/tests/list_keyed_evaluation_order_nested.phpt10
-rw-r--r--Zend/tests/list_keyed_undefined.phpt4
-rw-r--r--Zend/tests/lsb_001.phpt40
-rw-r--r--Zend/tests/lsb_002.phpt40
-rw-r--r--Zend/tests/lsb_003.phpt8
-rw-r--r--Zend/tests/lsb_004.phpt8
-rw-r--r--Zend/tests/lsb_005.phpt36
-rw-r--r--Zend/tests/lsb_006.phpt2
-rw-r--r--Zend/tests/lsb_007.phpt2
-rw-r--r--Zend/tests/lsb_008.phpt1
-rw-r--r--Zend/tests/lsb_009.phpt1
-rw-r--r--Zend/tests/lsb_010.phpt22
-rw-r--r--Zend/tests/lsb_011.phpt18
-rw-r--r--Zend/tests/lsb_012.phpt18
-rw-r--r--Zend/tests/lsb_013.phpt12
-rw-r--r--Zend/tests/lsb_014.phpt14
-rw-r--r--Zend/tests/lsb_015.phpt2
-rw-r--r--Zend/tests/lsb_016.phpt2
-rw-r--r--Zend/tests/lsb_017.phpt14
-rw-r--r--Zend/tests/lsb_018.phpt42
-rw-r--r--Zend/tests/lsb_019.phpt32
-rw-r--r--Zend/tests/lsb_020.phpt32
-rw-r--r--Zend/tests/lsb_021.phpt7
-rw-r--r--Zend/tests/lsb_022.phpt33
-rw-r--r--Zend/tests/magic_methods_001.phpt38
-rw-r--r--Zend/tests/magic_methods_002.phpt8
-rw-r--r--Zend/tests/magic_methods_003.phpt8
-rw-r--r--Zend/tests/magic_methods_004.phpt8
-rw-r--r--Zend/tests/magic_methods_005.phpt4
-rw-r--r--Zend/tests/magic_methods_006.phpt4
-rw-r--r--Zend/tests/magic_methods_007.phpt4
-rw-r--r--Zend/tests/magic_methods_008.phpt8
-rw-r--r--Zend/tests/magic_methods_009.phpt6
-rw-r--r--Zend/tests/magic_methods_010.phpt8
-rw-r--r--Zend/tests/magic_methods_011.phpt10
-rw-r--r--Zend/tests/magic_methods_012.phpt10
-rw-r--r--Zend/tests/magic_methods_013.phpt10
-rw-r--r--Zend/tests/magic_methods_014.phpt10
-rw-r--r--Zend/tests/magic_methods_015.phpt10
-rw-r--r--Zend/tests/magic_methods_016.phpt10
-rw-r--r--Zend/tests/magic_methods_017.phpt10
-rw-r--r--Zend/tests/magic_methods_018.phpt10
-rw-r--r--Zend/tests/magic_methods_019.phpt10
-rw-r--r--Zend/tests/magic_methods_020.phpt12
-rw-r--r--Zend/tests/magic_methods_021.phpt21
-rw-r--r--Zend/tests/magic_methods_inheritance_rules.phpt70
-rw-r--r--Zend/tests/magic_methods_inheritance_rules_non_trivial_01.phpt18
-rw-r--r--Zend/tests/magic_methods_inheritance_rules_non_trivial_02.phpt18
-rw-r--r--Zend/tests/magic_methods_serialize.phpt10
-rw-r--r--Zend/tests/magic_methods_set_state.phpt14
-rw-r--r--Zend/tests/magic_methods_sleep.phpt10
-rw-r--r--Zend/tests/magic_methods_unserialize.phpt10
-rw-r--r--Zend/tests/magic_methods_wakeup.phpt10
-rw-r--r--Zend/tests/match/001.phpt36
-rw-r--r--Zend/tests/match/002.phpt19
-rw-r--r--Zend/tests/match/003.phpt24
-rw-r--r--Zend/tests/match/004.phpt31
-rw-r--r--Zend/tests/match/005.phpt12
-rw-r--r--Zend/tests/match/006.phpt13
-rw-r--r--Zend/tests/match/007.phpt26
-rw-r--r--Zend/tests/match/008.phpt25
-rw-r--r--Zend/tests/match/009.phpt24
-rw-r--r--Zend/tests/match/011.phpt19
-rw-r--r--Zend/tests/match/012.phpt36
-rw-r--r--Zend/tests/match/017.phpt93
-rw-r--r--Zend/tests/match/023.phpt21
-rw-r--r--Zend/tests/match/024.phpt20
-rw-r--r--Zend/tests/match/027.phpt37
-rw-r--r--Zend/tests/match/028.phpt37
-rw-r--r--Zend/tests/match/029.phpt23
-rw-r--r--Zend/tests/match/030.phpt23
-rw-r--r--Zend/tests/match/037.phpt69
-rw-r--r--Zend/tests/match/038.phpt15
-rw-r--r--Zend/tests/match/039.phpt61
-rw-r--r--Zend/tests/match/040.phpt44
-rw-r--r--Zend/tests/match/041.phpt33
-rw-r--r--Zend/tests/match/042.phpt22
-rw-r--r--Zend/tests/method_argument_binding.phpt4
-rw-r--r--Zend/tests/method_exists_002.phpt48
-rw-r--r--Zend/tests/method_static_var.phpt28
-rw-r--r--Zend/tests/methods-on-non-objects-call-user-func.phpt15
-rw-r--r--Zend/tests/methods-on-non-objects-catch.phpt2
-rw-r--r--Zend/tests/methods-on-non-objects-usort.phpt6
-rw-r--r--Zend/tests/mod_001.phpt8
-rw-r--r--Zend/tests/mul_001.phpt8
-rw-r--r--Zend/tests/multibyte/bug68665.phpt6
-rw-r--r--Zend/tests/multibyte/multibyte_encoding_001.phpt5
-rw-r--r--Zend/tests/multibyte/multibyte_encoding_002.phpt5
-rw-r--r--Zend/tests/multibyte/multibyte_encoding_003.phptbin462 -> 328 bytes
-rw-r--r--Zend/tests/multibyte/multibyte_encoding_004.phpt13
-rw-r--r--Zend/tests/multibyte/multibyte_encoding_005.phpt13
-rw-r--r--Zend/tests/multibyte/multibyte_encoding_006.phptbin628 -> 494 bytes
-rw-r--r--Zend/tests/name_collision_07.phpt1
-rw-r--r--Zend/tests/name_collision_08.phpt1
-rw-r--r--Zend/tests/name_collision_09.phpt1
-rw-r--r--Zend/tests/named_params/__call.phpt37
-rw-r--r--Zend/tests/named_params/__invoke.phpt64
-rw-r--r--Zend/tests/named_params/assert.phpt30
-rw-r--r--Zend/tests/named_params/attributes.phpt50
-rw-r--r--Zend/tests/named_params/attributes_duplicate_named_param.phpt11
-rw-r--r--Zend/tests/named_params/attributes_named_flags.phpt21
-rw-r--r--Zend/tests/named_params/attributes_named_flags_incorrect.phpt22
-rw-r--r--Zend/tests/named_params/attributes_positional_after_named.phpt14
-rw-r--r--Zend/tests/named_params/backtrace.phpt69
-rw-r--r--Zend/tests/named_params/basic.phpt106
-rw-r--r--Zend/tests/named_params/call_user_func.phpt114
-rw-r--r--Zend/tests/named_params/call_user_func_array.phpt72
-rw-r--r--Zend/tests/named_params/cannot_pass_by_ref.phpt13
-rw-r--r--Zend/tests/named_params/ctor_extra_named_args.phpt23
-rw-r--r--Zend/tests/named_params/defaults.phpt35
-rw-r--r--Zend/tests/named_params/duplicate_param.phpt23
-rw-r--r--Zend/tests/named_params/func_get_args.phpt29
-rw-r--r--Zend/tests/named_params/internal.phpt39
-rw-r--r--Zend/tests/named_params/internal_variadics.phpt21
-rw-r--r--Zend/tests/named_params/missing_param.phpt38
-rw-r--r--Zend/tests/named_params/positional_after_named.phpt10
-rw-r--r--Zend/tests/named_params/references.phpt39
-rw-r--r--Zend/tests/named_params/reserved.phpt15
-rw-r--r--Zend/tests/named_params/runtime_cache_init.phpt17
-rw-r--r--Zend/tests/named_params/undef_var.phpt17
-rw-r--r--Zend/tests/named_params/unknown_named_param.phpt47
-rw-r--r--Zend/tests/named_params/unpack.phpt85
-rw-r--r--Zend/tests/named_params/unpack_and_named_1.phpt10
-rw-r--r--Zend/tests/named_params/unpack_and_named_2.phpt10
-rw-r--r--Zend/tests/named_params/variadic.phpt66
-rw-r--r--Zend/tests/namespace_first_stmt_nop.phpt10
-rw-r--r--Zend/tests/namespace_name_namespace.phpt10
-rw-r--r--Zend/tests/namespace_name_namespace_start.phpt10
-rw-r--r--Zend/tests/namespace_name_reserved_keywords.phpt37
-rw-r--r--Zend/tests/namespaced_name_whitespace.phpt10
-rw-r--r--Zend/tests/nested_method_and_function.phpt24
-rw-r--r--Zend/tests/non_well_formed_param_exception.phpt22
-rw-r--r--Zend/tests/not_002.phpt8
-rw-r--r--Zend/tests/nowdoc_015.phpt4
-rw-r--r--Zend/tests/ns_001.phpt1
-rw-r--r--Zend/tests/ns_002.phpt1
-rw-r--r--Zend/tests/ns_003.phpt1
-rw-r--r--Zend/tests/ns_004.phpt3
-rw-r--r--Zend/tests/ns_005.phpt1
-rw-r--r--Zend/tests/ns_006.phpt1
-rw-r--r--Zend/tests/ns_007.phpt1
-rw-r--r--Zend/tests/ns_008.phpt1
-rw-r--r--Zend/tests/ns_009.phpt1
-rw-r--r--Zend/tests/ns_010.phpt17
-rw-r--r--Zend/tests/ns_011.phpt1
-rw-r--r--Zend/tests/ns_012.phpt1
-rw-r--r--Zend/tests/ns_013.phpt3
-rw-r--r--Zend/tests/ns_014.phpt1
-rw-r--r--Zend/tests/ns_015.phpt3
-rw-r--r--Zend/tests/ns_016.phpt3
-rw-r--r--Zend/tests/ns_017.phpt3
-rw-r--r--Zend/tests/ns_018.phpt3
-rw-r--r--Zend/tests/ns_019.phpt3
-rw-r--r--Zend/tests/ns_020.phpt3
-rw-r--r--Zend/tests/ns_021.phpt9
-rw-r--r--Zend/tests/ns_022.inc6
-rw-r--r--Zend/tests/ns_022.phpt3
-rw-r--r--Zend/tests/ns_023.phpt1
-rw-r--r--Zend/tests/ns_024.phpt1
-rw-r--r--Zend/tests/ns_025.phpt5
-rw-r--r--Zend/tests/ns_026.phpt5
-rw-r--r--Zend/tests/ns_027.inc4
-rw-r--r--Zend/tests/ns_027.phpt5
-rw-r--r--Zend/tests/ns_028.inc4
-rw-r--r--Zend/tests/ns_028.phpt5
-rw-r--r--Zend/tests/ns_029.phpt1
-rw-r--r--Zend/tests/ns_030.phpt1
-rw-r--r--Zend/tests/ns_031.phpt9
-rw-r--r--Zend/tests/ns_032.phpt9
-rw-r--r--Zend/tests/ns_033.phpt1
-rw-r--r--Zend/tests/ns_034.phpt9
-rw-r--r--Zend/tests/ns_035.phpt4
-rw-r--r--Zend/tests/ns_036.phpt10
-rw-r--r--Zend/tests/ns_037.phpt17
-rw-r--r--Zend/tests/ns_038.phpt3
-rw-r--r--Zend/tests/ns_039.phpt11
-rw-r--r--Zend/tests/ns_040.phpt17
-rw-r--r--Zend/tests/ns_041.phpt7
-rw-r--r--Zend/tests/ns_042.phpt1
-rw-r--r--Zend/tests/ns_043.phpt1
-rw-r--r--Zend/tests/ns_044.phpt1
-rw-r--r--Zend/tests/ns_045.phpt1
-rw-r--r--Zend/tests/ns_046.phpt1
-rw-r--r--Zend/tests/ns_047.phpt1
-rw-r--r--Zend/tests/ns_048.phpt1
-rw-r--r--Zend/tests/ns_049.phpt1
-rw-r--r--Zend/tests/ns_050.phpt3
-rw-r--r--Zend/tests/ns_051.phpt3
-rw-r--r--Zend/tests/ns_052.phpt3
-rw-r--r--Zend/tests/ns_053.phpt1
-rw-r--r--Zend/tests/ns_054.phpt20
-rw-r--r--Zend/tests/ns_055.phpt18
-rw-r--r--Zend/tests/ns_056.phpt20
-rw-r--r--Zend/tests/ns_057.phpt28
-rw-r--r--Zend/tests/ns_058.phpt28
-rw-r--r--Zend/tests/ns_059.phpt1
-rw-r--r--Zend/tests/ns_060.phpt1
-rw-r--r--Zend/tests/ns_061.phpt1
-rw-r--r--Zend/tests/ns_062.phpt1
-rw-r--r--Zend/tests/ns_063.phpt6
-rw-r--r--Zend/tests/ns_064.phpt22
-rw-r--r--Zend/tests/ns_065.inc4
-rw-r--r--Zend/tests/ns_065.phpt1
-rw-r--r--Zend/tests/ns_066.phpt1
-rw-r--r--Zend/tests/ns_067.phpt1
-rw-r--r--Zend/tests/ns_069.phpt2
-rw-r--r--Zend/tests/ns_070.phpt6
-rw-r--r--Zend/tests/ns_071.phpt8
-rw-r--r--Zend/tests/ns_072.phpt8
-rw-r--r--Zend/tests/ns_073.phpt2
-rw-r--r--Zend/tests/ns_074.phpt2
-rw-r--r--Zend/tests/ns_075.phpt1
-rw-r--r--Zend/tests/ns_076.phpt38
-rw-r--r--Zend/tests/ns_077_1.phpt3
-rw-r--r--Zend/tests/ns_077_2.phpt3
-rw-r--r--Zend/tests/ns_077_3.phpt3
-rw-r--r--Zend/tests/ns_077_4.phpt3
-rw-r--r--Zend/tests/ns_077_5.phpt3
-rw-r--r--Zend/tests/ns_077_7.phpt3
-rw-r--r--Zend/tests/ns_077_8.phpt3
-rw-r--r--Zend/tests/ns_078.phpt1
-rw-r--r--Zend/tests/ns_081.phpt4
-rw-r--r--Zend/tests/ns_084.phpt4
-rw-r--r--Zend/tests/ns_085.phpt5
-rw-r--r--Zend/tests/ns_086.phpt5
-rw-r--r--Zend/tests/ns_087.phpt5
-rw-r--r--Zend/tests/ns_088.phpt2
-rw-r--r--Zend/tests/ns_089.phpt1
-rw-r--r--Zend/tests/ns_090.phpt1
-rw-r--r--Zend/tests/ns_091.phpt1
-rw-r--r--Zend/tests/ns_092.phpt1
-rw-r--r--Zend/tests/ns_093.phpt1
-rw-r--r--Zend/tests/ns_094.phpt5
-rw-r--r--Zend/tests/ns_096.phpt2
-rw-r--r--Zend/tests/ns_trailing_comma_error_01.phpt2
-rw-r--r--Zend/tests/ns_trailing_comma_error_02.phpt2
-rw-r--r--Zend/tests/ns_trailing_comma_error_03.phpt2
-rw-r--r--Zend/tests/ns_trailing_comma_error_04.phpt2
-rw-r--r--Zend/tests/ns_trailing_comma_error_05.phpt2
-rw-r--r--Zend/tests/ns_trailing_comma_error_06.phpt2
-rw-r--r--Zend/tests/ns_trailing_comma_error_07.phpt2
-rw-r--r--Zend/tests/ns_trailing_comma_error_08.phpt2
-rw-r--r--Zend/tests/nullable_types/array.phpt1
-rw-r--r--Zend/tests/nullable_types/contravariant_nullable_param_succeeds.phpt1
-rw-r--r--Zend/tests/nullable_types/contravariant_nullable_return_fails.phpt1
-rw-r--r--Zend/tests/nullable_types/covariant_nullable_param_fails.phpt1
-rw-r--r--Zend/tests/nullable_types/covariant_nullable_return_succeds.phpt1
-rw-r--r--Zend/tests/nullable_types/float.phpt1
-rw-r--r--Zend/tests/nullable_types/int.phpt1
-rw-r--r--Zend/tests/nullable_types/invariant_param_and_return_succeeds.phpt1
-rw-r--r--Zend/tests/nullable_types/nullable_type_parameters_do_not_have_default_value.phpt1
-rw-r--r--Zend/tests/nullable_types/string.phpt1
-rw-r--r--Zend/tests/nullable_types/union_nullable_property_fails.phpt15
-rw-r--r--Zend/tests/nullsafe_operator/001.phpt106
-rw-r--r--Zend/tests/nullsafe_operator/002.phpt42
-rw-r--r--Zend/tests/nullsafe_operator/003.phpt57
-rw-r--r--Zend/tests/nullsafe_operator/004.phpt11
-rw-r--r--Zend/tests/nullsafe_operator/005.phpt11
-rw-r--r--Zend/tests/nullsafe_operator/006.phpt11
-rw-r--r--Zend/tests/nullsafe_operator/007.phpt11
-rw-r--r--Zend/tests/nullsafe_operator/008.phpt11
-rw-r--r--Zend/tests/nullsafe_operator/009.phpt11
-rw-r--r--Zend/tests/nullsafe_operator/010.phpt11
-rw-r--r--Zend/tests/nullsafe_operator/011.phpt54
-rw-r--r--Zend/tests/nullsafe_operator/012.phpt18
-rw-r--r--Zend/tests/nullsafe_operator/013.phpt67
-rw-r--r--Zend/tests/nullsafe_operator/014.phpt47
-rw-r--r--Zend/tests/nullsafe_operator/015.phpt12
-rw-r--r--Zend/tests/nullsafe_operator/016.phpt35
-rw-r--r--Zend/tests/nullsafe_operator/017.phpt12
-rw-r--r--Zend/tests/nullsafe_operator/018.phpt19
-rw-r--r--Zend/tests/nullsafe_operator/019.phpt27
-rw-r--r--Zend/tests/nullsafe_operator/020.phpt19
-rw-r--r--Zend/tests/nullsafe_operator/021.phpt22
-rw-r--r--Zend/tests/nullsafe_operator/022.phpt11
-rw-r--r--Zend/tests/nullsafe_operator/023.phpt44
-rw-r--r--Zend/tests/nullsafe_operator/024.phpt11
-rw-r--r--Zend/tests/nullsafe_operator/025.phpt14
-rw-r--r--Zend/tests/nullsafe_operator/026.phpt26
-rw-r--r--Zend/tests/nullsafe_operator/027.phpt23
-rw-r--r--Zend/tests/nullsafe_operator/028.phpt24
-rw-r--r--Zend/tests/nullsafe_operator/029.phpt11
-rw-r--r--Zend/tests/nullsafe_operator/030.phpt22
-rw-r--r--Zend/tests/nullsafe_operator/031.phpt18
-rw-r--r--Zend/tests/nullsafe_operator/032.phpt25
-rw-r--r--Zend/tests/nullsafe_operator/033.phpt61
-rw-r--r--Zend/tests/nullsafe_operator/034.phpt28
-rw-r--r--Zend/tests/nullsafe_operator/035.phpt27
-rw-r--r--Zend/tests/nullsafe_operator/036.phpt28
-rw-r--r--Zend/tests/nullsafe_operator/037.phpt15
-rw-r--r--Zend/tests/nullsafe_operator/038.phpt12
-rw-r--r--Zend/tests/nullsafe_operator/039.phpt18
-rw-r--r--Zend/tests/numeric_literal_separator_001.phpt1
-rw-r--r--Zend/tests/numeric_literal_separator_002.phpt3
-rw-r--r--Zend/tests/numeric_literal_separator_003.phpt3
-rw-r--r--Zend/tests/numeric_literal_separator_004.phpt3
-rw-r--r--Zend/tests/numeric_literal_separator_005.phpt3
-rw-r--r--Zend/tests/numeric_literal_separator_006.phpt3
-rw-r--r--Zend/tests/numeric_literal_separator_007.phpt3
-rw-r--r--Zend/tests/numeric_literal_separator_008.phpt3
-rw-r--r--Zend/tests/numeric_literal_separator_009.phpt3
-rw-r--r--Zend/tests/numeric_strings/array_offset.phpt86
-rw-r--r--Zend/tests/numeric_strings/explicit_cast_leading_numeric_must_work.phpt16
-rw-r--r--Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt (renamed from Zend/tests/numeric_string_errors_assign.phpt)235
-rw-r--r--Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt (renamed from Zend/tests/numeric_string_errors.phpt)206
-rw-r--r--Zend/tests/numeric_strings/neg_num_string.phpt (renamed from Zend/tests/neg_num_string.phpt)0
-rw-r--r--Zend/tests/numeric_strings/string_offset.phpt72
-rw-r--r--Zend/tests/numeric_strings/trailling_whitespaces.phpt59
-rw-r--r--Zend/tests/object_handlers.phpt50
-rw-r--r--Zend/tests/object_types/invalid_default_value.phpt2
-rw-r--r--Zend/tests/object_types/missing_return_type_inheritance_in_class.phpt1
-rw-r--r--Zend/tests/object_types/missing_return_type_inheritance_in_interface.phpt1
-rw-r--r--Zend/tests/object_types/return_type_in_class.phpt5
-rw-r--r--Zend/tests/object_types/return_type_in_function.phpt5
-rw-r--r--Zend/tests/object_types/return_type_inheritance_in_class.phpt5
-rw-r--r--Zend/tests/object_types/return_type_inheritance_in_interface.phpt5
-rw-r--r--Zend/tests/object_types/return_type_reflection.phpt1
-rw-r--r--Zend/tests/object_types/type_hint_in_class_method.phpt3
-rw-r--r--Zend/tests/object_types/type_hint_in_function.phpt3
-rw-r--r--Zend/tests/object_types/type_hint_reflection.phpt1
-rw-r--r--Zend/tests/objects_002.phpt10
-rw-r--r--Zend/tests/objects_003.phpt10
-rw-r--r--Zend/tests/objects_004.phpt10
-rw-r--r--Zend/tests/objects_005.phpt10
-rw-r--r--Zend/tests/objects_006.phpt10
-rw-r--r--Zend/tests/objects_007.phpt10
-rw-r--r--Zend/tests/objects_008.phpt10
-rw-r--r--Zend/tests/objects_009.phpt6
-rw-r--r--Zend/tests/objects_010.phpt8
-rw-r--r--Zend/tests/objects_011.phpt8
-rw-r--r--Zend/tests/objects_015.phpt2
-rw-r--r--Zend/tests/objects_017.phpt4
-rw-r--r--Zend/tests/objects_018.phpt4
-rw-r--r--Zend/tests/objects_020.phpt26
-rw-r--r--Zend/tests/objects_021.phpt34
-rw-r--r--Zend/tests/objects_022.phpt2
-rw-r--r--Zend/tests/objects_024.phpt18
-rw-r--r--Zend/tests/objects_025.phpt12
-rw-r--r--Zend/tests/objects_026.phpt2
-rw-r--r--Zend/tests/objects_027.phpt26
-rw-r--r--Zend/tests/objects_028.phpt14
-rw-r--r--Zend/tests/objects_029.phpt20
-rw-r--r--Zend/tests/objects_030.phpt20
-rw-r--r--Zend/tests/objects_032.phpt2
-rw-r--r--Zend/tests/objects_033.phpt1
-rw-r--r--Zend/tests/oct_overflow.phpt16
-rw-r--r--Zend/tests/oct_overflow_char.phpt1
-rw-r--r--Zend/tests/offset_array.phpt26
-rw-r--r--Zend/tests/offset_assign.phpt6
-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.phpt62
-rw-r--r--Zend/tests/operator_unsupported_types.phpt2066
-rw-r--r--Zend/tests/output_started_at_eval.phpt11
-rw-r--r--Zend/tests/overloaded_func_001.phpt10
-rw-r--r--Zend/tests/parameter_default_values/internal_declaration_error_class_const.phpt13
-rw-r--r--Zend/tests/parameter_default_values/internal_declaration_error_const.phpt13
-rw-r--r--Zend/tests/parameter_default_values/internal_declaration_error_false.phpt12
-rw-r--r--Zend/tests/parameter_default_values/internal_declaration_error_int.phpt13
-rw-r--r--Zend/tests/parameter_default_values/internal_declaration_error_null.phpt13
-rw-r--r--Zend/tests/parameter_default_values/userland_declaration_error_class_const.phpt26
-rw-r--r--Zend/tests/parameter_default_values/userland_declaration_error_const.phpt26
-rw-r--r--Zend/tests/parse_str_with_unpack.phpt16
-rw-r--r--Zend/tests/php_errormsg_misoptimization.phpt22
-rw-r--r--Zend/tests/pow_array_leak.phpt24
-rw-r--r--Zend/tests/property_exists.phpt48
-rw-r--r--Zend/tests/property_guard_hash_val.phpt2
-rw-r--r--Zend/tests/real_cast.phpt10
-rw-r--r--Zend/tests/real_cast_deprecation.phpt11
-rw-r--r--Zend/tests/recv_init_ref_type.phpt18
-rw-r--r--Zend/tests/remove_predecessor_of_pi_node.phpt2
-rw-r--r--Zend/tests/require_once_warning_to_exception.phpt19
-rw-r--r--Zend/tests/require_parse_exception.phpt6
-rw-r--r--Zend/tests/required_param_after_optional.phpt14
-rw-r--r--Zend/tests/result_unused.phpt11
-rw-r--r--Zend/tests/return_ref_none.phpt14
-rw-r--r--Zend/tests/return_types/001.phpt3
-rw-r--r--Zend/tests/return_types/002.phpt3
-rw-r--r--Zend/tests/return_types/003.phpt3
-rw-r--r--Zend/tests/return_types/004.phpt3
-rw-r--r--Zend/tests/return_types/005.phpt3
-rw-r--r--Zend/tests/return_types/006.phpt1
-rw-r--r--Zend/tests/return_types/007.phpt1
-rw-r--r--Zend/tests/return_types/009.phpt1
-rw-r--r--Zend/tests/return_types/010.phpt3
-rw-r--r--Zend/tests/return_types/011.phpt1
-rw-r--r--Zend/tests/return_types/012.phpt1
-rw-r--r--Zend/tests/return_types/013.phpt3
-rw-r--r--Zend/tests/return_types/014.phpt5
-rw-r--r--Zend/tests/return_types/015.phpt1
-rw-r--r--Zend/tests/return_types/016.phpt1
-rw-r--r--Zend/tests/return_types/017.phpt1
-rw-r--r--Zend/tests/return_types/018.phpt5
-rw-r--r--Zend/tests/return_types/019.phpt7
-rw-r--r--Zend/tests/return_types/020.phpt1
-rw-r--r--Zend/tests/return_types/021.phpt1
-rw-r--r--Zend/tests/return_types/022.phpt1
-rw-r--r--Zend/tests/return_types/023.phpt12
-rw-r--r--Zend/tests/return_types/024.phpt1
-rw-r--r--Zend/tests/return_types/025.phpt1
-rw-r--r--Zend/tests/return_types/026.phpt1
-rw-r--r--Zend/tests/return_types/027.phpt1
-rw-r--r--Zend/tests/return_types/028.phpt12
-rw-r--r--Zend/tests/return_types/029.phpt14
-rw-r--r--Zend/tests/return_types/030.phpt4
-rw-r--r--Zend/tests/return_types/031.phpt4
-rw-r--r--Zend/tests/return_types/032.phpt4
-rw-r--r--Zend/tests/return_types/033.phpt10
-rw-r--r--Zend/tests/return_types/034.phpt10
-rw-r--r--Zend/tests/return_types/035.phpt10
-rw-r--r--Zend/tests/return_types/036.phpt11
-rw-r--r--Zend/tests/return_types/037.phpt11
-rw-r--r--Zend/tests/return_types/038.phpt10
-rw-r--r--Zend/tests/return_types/039.phpt10
-rw-r--r--Zend/tests/return_types/040.phpt10
-rw-r--r--Zend/tests/return_types/041.phpt10
-rw-r--r--Zend/tests/return_types/042.phpt24
-rw-r--r--Zend/tests/return_types/043.phpt29
-rw-r--r--Zend/tests/return_types/044.phpt10
-rw-r--r--Zend/tests/return_types/bug70557.phpt10
-rw-r--r--Zend/tests/return_types/bug71092.phpt14
-rw-r--r--Zend/tests/return_types/bug71978.phpt14
-rw-r--r--Zend/tests/return_types/generators001.phpt24
-rw-r--r--Zend/tests/return_types/generators002.phpt5
-rw-r--r--Zend/tests/return_types/generators004.phpt1
-rw-r--r--Zend/tests/return_types/generators005.phpt1
-rw-r--r--Zend/tests/return_types/generators006.phpt10
-rw-r--r--Zend/tests/return_types/inheritance001.phpt1
-rw-r--r--Zend/tests/return_types/inheritance002.phpt1
-rw-r--r--Zend/tests/return_types/inheritance003.phpt1
-rw-r--r--Zend/tests/return_types/inheritance004.phpt1
-rw-r--r--Zend/tests/return_types/inheritance008.phpt1
-rw-r--r--Zend/tests/return_types/inheritance009.phpt1
-rw-r--r--Zend/tests/return_types/internal_functions001.phpt6
-rw-r--r--Zend/tests/return_types/return_reference_separation.phpt6
-rw-r--r--Zend/tests/return_types/rfc001.phpt3
-rw-r--r--Zend/tests/return_types/rfc002.phpt1
-rw-r--r--Zend/tests/return_types/rfc003.phpt3
-rw-r--r--Zend/tests/return_types/rfc004.phpt1
-rw-r--r--Zend/tests/return_types/void_allowed.phpt1
-rw-r--r--Zend/tests/return_types/void_disallowed1.phpt1
-rw-r--r--Zend/tests/return_types/void_disallowed2.phpt1
-rw-r--r--Zend/tests/return_types/void_parameter.phpt1
-rw-r--r--Zend/tests/rope_with_exception.phpt36
-rw-r--r--Zend/tests/runtime_compile_time_binary_operands.phpt252
-rw-r--r--Zend/tests/selfParent_001.phpt18
-rw-r--r--Zend/tests/selfParent_002.phpt18
-rw-r--r--Zend/tests/self_and.phpt12
-rw-r--r--Zend/tests/self_instanceof_outside_class.phpt2
-rw-r--r--Zend/tests/self_method_or_prop_outside_class.phpt8
-rw-r--r--Zend/tests/self_mod.phpt12
-rw-r--r--Zend/tests/self_or.phpt12
-rw-r--r--Zend/tests/self_xor.phpt12
-rw-r--r--Zend/tests/settype_array.phptbin1005 -> 1071 bytes
-rw-r--r--Zend/tests/settype_bool.phpt36
-rw-r--r--Zend/tests/settype_double.phpt40
-rw-r--r--Zend/tests/settype_int.phpt38
-rw-r--r--Zend/tests/settype_null.phpt36
-rw-r--r--Zend/tests/settype_object.phptbin1130 -> 1187 bytes
-rw-r--r--Zend/tests/settype_resource.phptbin1579 -> 1247 bytes
-rw-r--r--Zend/tests/settype_string.phptbin745 -> 804 bytes
-rw-r--r--Zend/tests/shift_001.phpt12
-rw-r--r--Zend/tests/shift_002.phpt12
-rw-r--r--Zend/tests/short_echo_as_identifier.phpt15
-rw-r--r--Zend/tests/special_name_error1.phpt10
-rw-r--r--Zend/tests/static_in_trait_insteadof_list.phpt18
-rw-r--r--Zend/tests/static_in_trait_insteadof_reference.phpt18
-rw-r--r--Zend/tests/static_method_non_existing_class.phpt2
-rw-r--r--Zend/tests/static_variable.phpt8
-rw-r--r--Zend/tests/str_offset_001.phpt10
-rw-r--r--Zend/tests/str_offset_003.phpt10
-rw-r--r--Zend/tests/str_offset_004.phpt4
-rw-r--r--Zend/tests/str_or_obj_of_class_zpp.phpt70
-rw-r--r--Zend/tests/str_or_obj_zpp.phpt53
-rw-r--r--Zend/tests/strict_001.phpt2
-rw-r--r--Zend/tests/strict_002.phpt2
-rw-r--r--Zend/tests/string_offset_int_min_max.phpt4
-rw-r--r--Zend/tests/string_to_number_comparison.phpt92
-rw-r--r--Zend/tests/stringable_automatic_implementation.phpt35
-rw-r--r--Zend/tests/strlen.phpt1
-rw-r--r--Zend/tests/sub_001.phpt8
-rw-r--r--Zend/tests/temporary_cleaning_001.phpt12
-rw-r--r--Zend/tests/temporary_cleaning_002.phpt12
-rw-r--r--Zend/tests/temporary_cleaning_004.phpt46
-rw-r--r--Zend/tests/temporary_cleaning_005.phpt56
-rw-r--r--Zend/tests/temporary_cleaning_008.phpt10
-rw-r--r--Zend/tests/temporary_cleaning_010.phpt2
-rw-r--r--Zend/tests/temporary_cleaning_011.phpt10
-rw-r--r--Zend/tests/temporary_cleaning_012.phpt2
-rw-r--r--Zend/tests/temporary_cleaning_013.phpt348
-rw-r--r--Zend/tests/temporary_cleaning_014.phpt2
-rw-r--r--Zend/tests/temporary_cleaning_015.phpt4
-rw-r--r--Zend/tests/ternary_associativity.phpt16
-rw-r--r--Zend/tests/ternary_associativity_1.phpt10
-rw-r--r--Zend/tests/ternary_associativity_2.phpt10
-rw-r--r--Zend/tests/ternary_associativity_3.phpt10
-rw-r--r--Zend/tests/this_as_global.phpt4
-rw-r--r--Zend/tests/this_as_parameter.phpt2
-rw-r--r--Zend/tests/this_as_static.phpt4
-rw-r--r--Zend/tests/this_in_catch.phpt14
-rw-r--r--Zend/tests/this_in_eval.phpt9
-rw-r--r--Zend/tests/this_in_extract.phpt2
-rw-r--r--Zend/tests/this_in_foreach_001.phpt2
-rw-r--r--Zend/tests/this_in_foreach_002.phpt2
-rw-r--r--Zend/tests/this_in_foreach_003.phpt2
-rw-r--r--Zend/tests/this_in_foreach_004.phpt2
-rw-r--r--Zend/tests/this_in_isset.phpt26
-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/this_reassign.phpt6
-rw-r--r--Zend/tests/throw/001.phpt173
-rw-r--r--Zend/tests/throw/002.phpt128
-rw-r--r--Zend/tests/throw/leaks.phpt31
-rw-r--r--Zend/tests/trait_exists_001.phpt6
-rw-r--r--Zend/tests/trait_type_errors.phpt43
-rw-r--r--Zend/tests/traits/abstract_method_1.phpt18
-rw-r--r--Zend/tests/traits/abstract_method_10.phpt19
-rw-r--r--Zend/tests/traits/abstract_method_2.phpt22
-rw-r--r--Zend/tests/traits/abstract_method_3.phpt18
-rw-r--r--Zend/tests/traits/abstract_method_4.phpt20
-rw-r--r--Zend/tests/traits/abstract_method_5.phpt18
-rw-r--r--Zend/tests/traits/abstract_method_6.phpt20
-rw-r--r--Zend/tests/traits/abstract_method_7.phpt23
-rw-r--r--Zend/tests/traits/abstract_method_8.phpt21
-rw-r--r--Zend/tests/traits/abstract_method_9.phpt29
-rw-r--r--Zend/tests/traits/bug54441.phpt2
-rw-r--r--Zend/tests/traits/bug55214.phpt4
-rw-r--r--Zend/tests/traits/bug55355.phpt10
-rw-r--r--Zend/tests/traits/bug55372.phpt22
-rw-r--r--Zend/tests/traits/bug55424.phpt44
-rw-r--r--Zend/tests/traits/bug55524.phpt2
-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/bug60145.phpt5
-rw-r--r--Zend/tests/traits/bug60153.phpt1
-rw-r--r--Zend/tests/traits/bug60165a.phpt1
-rw-r--r--Zend/tests/traits/bug60165b.phpt1
-rw-r--r--Zend/tests/traits/bug60165c.phpt1
-rw-r--r--Zend/tests/traits/bug60165d.phpt1
-rw-r--r--Zend/tests/traits/bug60173.phpt1
-rw-r--r--Zend/tests/traits/bug60217a.phpt1
-rw-r--r--Zend/tests/traits/bug60217b.phpt3
-rw-r--r--Zend/tests/traits/bug60217c.phpt3
-rw-r--r--Zend/tests/traits/bug60717.phpt93
-rw-r--r--Zend/tests/traits/bug60809.phpt32
-rw-r--r--Zend/tests/traits/bug61052.phpt1
-rw-r--r--Zend/tests/traits/bug61998.phpt1
-rw-r--r--Zend/tests/traits/bug63911.phpt1
-rw-r--r--Zend/tests/traits/bug65576a.phpt1
-rw-r--r--Zend/tests/traits/bug65576b.phpt1
-rw-r--r--Zend/tests/traits/bug75607.phpt6
-rw-r--r--Zend/tests/traits/bug75607a.phpt8
-rw-r--r--Zend/tests/traits/bug76539.phpt12
-rw-r--r--Zend/tests/traits/bug76700.phpt1
-rw-r--r--Zend/tests/traits/bug76773.phpt1
-rw-r--r--Zend/tests/traits/bugs/abstract-methods01.phpt2
-rw-r--r--Zend/tests/traits/bugs/abstract-methods02.phpt4
-rw-r--r--Zend/tests/traits/bugs/abstract-methods04.phpt10
-rw-r--r--Zend/tests/traits/bugs/abstract-methods05.phpt6
-rw-r--r--Zend/tests/traits/bugs/abstract-methods06.phpt4
-rw-r--r--Zend/tests/traits/bugs/alias-semantics.phpt2
-rw-r--r--Zend/tests/traits/bugs/alias-semantics02.phpt4
-rw-r--r--Zend/tests/traits/bugs/case-sensitive.phpt14
-rw-r--r--Zend/tests/traits/bugs/interfaces.phpt4
-rw-r--r--Zend/tests/traits/bugs/missing-trait.phpt2
-rw-r--r--Zend/tests/traits/conflict001.phpt6
-rw-r--r--Zend/tests/traits/conflict002.phpt2
-rw-r--r--Zend/tests/traits/conflict003.phpt2
-rw-r--r--Zend/tests/traits/error_001.phpt20
-rw-r--r--Zend/tests/traits/error_002.phpt4
-rw-r--r--Zend/tests/traits/error_003.phpt2
-rw-r--r--Zend/tests/traits/error_004.phpt2
-rw-r--r--Zend/tests/traits/error_005.phpt2
-rw-r--r--Zend/tests/traits/error_006.phpt2
-rw-r--r--Zend/tests/traits/error_010.phpt8
-rw-r--r--Zend/tests/traits/error_011.phpt10
-rw-r--r--Zend/tests/traits/error_012.phpt6
-rw-r--r--Zend/tests/traits/error_013.phpt4
-rw-r--r--Zend/tests/traits/error_014.phpt6
-rw-r--r--Zend/tests/traits/error_015.phpt12
-rw-r--r--Zend/tests/traits/error_016.phpt2
-rw-r--r--Zend/tests/traits/get_declared_traits_002.phpt12
-rw-r--r--Zend/tests/traits/inheritance001.phpt2
-rw-r--r--Zend/tests/traits/interface_001.phpt8
-rw-r--r--Zend/tests/traits/interface_002.phpt8
-rw-r--r--Zend/tests/traits/interface_003.phpt14
-rw-r--r--Zend/tests/traits/language001.phpt2
-rw-r--r--Zend/tests/traits/language004.phpt2
-rw-r--r--Zend/tests/traits/language005.phpt8
-rw-r--r--Zend/tests/traits/language007.phpt2
-rw-r--r--Zend/tests/traits/language008a.phpt2
-rw-r--r--Zend/tests/traits/language008b.phpt2
-rw-r--r--Zend/tests/traits/language009.phpt4
-rw-r--r--Zend/tests/traits/language010.phpt2
-rw-r--r--Zend/tests/traits/language011.phpt4
-rw-r--r--Zend/tests/traits/language014.phpt2
-rw-r--r--Zend/tests/traits/language015.phpt9
-rw-r--r--Zend/tests/traits/language016.phpt9
-rw-r--r--Zend/tests/traits/language017.phpt9
-rw-r--r--Zend/tests/traits/language018.phpt8
-rw-r--r--Zend/tests/traits/language019.phpt8
-rw-r--r--Zend/tests/traits/methods_001.phpt26
-rw-r--r--Zend/tests/traits/methods_002.phpt18
-rw-r--r--Zend/tests/traits/methods_003.phpt14
-rw-r--r--Zend/tests/traits/noctor001.phpt29
-rw-r--r--Zend/tests/traits/property001.phpt8
-rw-r--r--Zend/tests/traits/property002.phpt10
-rw-r--r--Zend/tests/traits/property003.phpt4
-rw-r--r--Zend/tests/traits/property004.phpt10
-rw-r--r--Zend/tests/traits/property005.phpt2
-rw-r--r--Zend/tests/traits/property009.phpt2
-rw-r--r--Zend/tests/traits/static_001.phpt18
-rw-r--r--Zend/tests/traits/static_002.phpt20
-rw-r--r--Zend/tests/traits/static_003.phpt26
-rw-r--r--Zend/tests/traits/static_004.phpt18
-rw-r--r--Zend/tests/traits/static_forward_static_call.phpt28
-rw-r--r--Zend/tests/traits/static_get_called_class.phpt20
-rw-r--r--Zend/tests/traits/trait_constant_001.phpt8
-rw-r--r--Zend/tests/traits/trait_constant_002.phpt28
-rw-r--r--Zend/tests/try/bug70228_7.phpt2
-rw-r--r--Zend/tests/try/bug70228_8.phpt8
-rw-r--r--Zend/tests/try/bug72213.phpt22
-rw-r--r--Zend/tests/try/bug72213_2.phpt1
-rw-r--r--Zend/tests/try/bug72629.phpt3
-rw-r--r--Zend/tests/try/bug74444.phpt131
-rw-r--r--Zend/tests/try/catch_002.phpt24
-rw-r--r--Zend/tests/try/catch_003.phpt32
-rw-r--r--Zend/tests/try/catch_004.phpt50
-rw-r--r--Zend/tests/try/catch_novar_1.phpt32
-rw-r--r--Zend/tests/try/catch_novar_2.phpt26
-rw-r--r--Zend/tests/try/finally_goto_001.phpt4
-rw-r--r--Zend/tests/try/finally_goto_002.phpt4
-rw-r--r--Zend/tests/try/finally_goto_003.phpt4
-rw-r--r--Zend/tests/try/finally_goto_004.phpt4
-rw-r--r--Zend/tests/try/finally_goto_005.phpt6
-rw-r--r--Zend/tests/try/try_catch_finally_006.phpt4
-rw-r--r--Zend/tests/try/try_catch_finally_007.phpt6
-rw-r--r--Zend/tests/try/try_finally_010.phpt33
-rw-r--r--Zend/tests/try/try_finally_011.phpt8
-rw-r--r--Zend/tests/try/try_finally_012.phpt32
-rw-r--r--Zend/tests/try/try_finally_013.phpt2
-rw-r--r--Zend/tests/try/try_finally_014.phpt2
-rw-r--r--Zend/tests/try/try_finally_015.phpt2
-rw-r--r--Zend/tests/try/try_finally_016.phpt2
-rw-r--r--Zend/tests/try/try_finally_017.phpt2
-rw-r--r--Zend/tests/try/try_finally_019.phpt14
-rw-r--r--Zend/tests/try/try_finally_020.phpt14
-rw-r--r--Zend/tests/try/try_finally_021.phpt4
-rw-r--r--Zend/tests/try/try_finally_022.phpt56
-rw-r--r--Zend/tests/try/try_multicatch_001.phpt6
-rw-r--r--Zend/tests/try/try_multicatch_002.phpt8
-rw-r--r--Zend/tests/try/try_multicatch_003.phpt8
-rw-r--r--Zend/tests/try/try_multicatch_004.phpt8
-rw-r--r--Zend/tests/try/try_multicatch_005.phpt16
-rw-r--r--Zend/tests/try/try_multicatch_006.phpt10
-rw-r--r--Zend/tests/try/try_multicatch_007.phpt10
-rw-r--r--Zend/tests/type_declarations/array_001.phpt4
-rw-r--r--Zend/tests/type_declarations/callable_001.phpt21
-rw-r--r--Zend/tests/type_declarations/callable_002.phpt7
-rw-r--r--Zend/tests/type_declarations/callable_003.phpt4
-rw-r--r--Zend/tests/type_declarations/confusable_type_warning.phpt48
-rw-r--r--Zend/tests/type_declarations/explicit_weak_include_strict.phpt2
-rw-r--r--Zend/tests/type_declarations/inexistent_class_hint_with_scalar_arg.phpt2
-rw-r--r--Zend/tests/type_declarations/internal_function_strict_mode.phpt18
-rw-r--r--Zend/tests/type_declarations/iterable_001.phpt3
-rw-r--r--Zend/tests/type_declarations/iterable_002.phpt2
-rw-r--r--Zend/tests/type_declarations/iterable_003.phpt6
-rw-r--r--Zend/tests/type_declarations/iterable_004.phpt2
-rw-r--r--Zend/tests/type_declarations/mixed/casting/mixed_cast_error.phpt10
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error1.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error2.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error3.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error4.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success1.phpt17
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success2.phpt17
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success3.phpt17
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success4.phpt17
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success5.phpt17
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success6.phpt17
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success7.phpt17
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error1.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error2.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error3.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error4.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error5.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error6.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error7.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error8.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_success.phpt17
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error1.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error2.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error3.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success1.phpt17
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success2.phpt57
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success3.phpt27
-rw-r--r--Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success4.phpt17
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/mixed_class_error.phpt12
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/mixed_parameter_error1.phpt12
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/mixed_parameter_error2.phpt12
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/mixed_parameter_success.phpt11
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/mixed_parameter_sucess4.phpt11
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/mixed_return_error.phpt13
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/mixed_return_success.phpt12
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/mixed_void_return_error.phpt13
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/nullable_mixed_parameter_error.phpt12
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/nullable_mixed_property_error.phpt13
-rw-r--r--Zend/tests/type_declarations/mixed/syntax/nullable_mixed_return_error.phpt12
-rw-r--r--Zend/tests/type_declarations/mixed/validation/mixed_parameter_strict_success.phpt20
-rw-r--r--Zend/tests/type_declarations/mixed/validation/mixed_parameter_weak_success.phpt19
-rw-r--r--Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt36
-rw-r--r--Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt35
-rw-r--r--Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt19
-rw-r--r--Zend/tests/type_declarations/mixed/validation/mixed_return_strict_success.phpt20
-rw-r--r--Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt18
-rw-r--r--Zend/tests/type_declarations/mixed/validation/mixed_return_weak_success.phpt19
-rw-r--r--Zend/tests/type_declarations/nullable_null.phpt2
-rw-r--r--Zend/tests/type_declarations/nullable_void.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_basic.phpt66
-rw-r--r--Zend/tests/type_declarations/scalar_constant_defaults.phpt44
-rw-r--r--Zend/tests/type_declarations/scalar_constant_defaults_error.phpt4
-rw-r--r--Zend/tests/type_declarations/scalar_float_with_invalid_default.phpt2
-rw-r--r--Zend/tests/type_declarations/scalar_none.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_null.phpt8
-rw-r--r--Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt2
-rw-r--r--Zend/tests/type_declarations/scalar_reserved2.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved2_class_alias.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved2_use.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved3.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved3_class_alias.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved3_use.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved4.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved4_class_alias.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved4_use.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved6.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved6_class_alias.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved6_use.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_reserved7.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_return_basic.phpt66
-rw-r--r--Zend/tests/type_declarations/scalar_return_basic_64bit.phpt68
-rw-r--r--Zend/tests/type_declarations/scalar_strict.phpt114
-rw-r--r--Zend/tests/type_declarations/scalar_strict_64bit.phpt116
-rw-r--r--Zend/tests/type_declarations/scalar_strict_basic.phpt60
-rw-r--r--Zend/tests/type_declarations/scalar_strict_declaration_placement_004.phpt1
-rw-r--r--Zend/tests/type_declarations/scalar_strict_declaration_placement_006.phpt3
-rw-r--r--Zend/tests/type_declarations/scalar_strict_declaration_placement_007.phpt3
-rw-r--r--Zend/tests/type_declarations/scalar_strict_declaration_placement_008.phpt2
-rw-r--r--Zend/tests/type_declarations/static_type_in_final_class.phpt17
-rw-r--r--Zend/tests/type_declarations/static_type_outside_class.phpt10
-rw-r--r--Zend/tests/type_declarations/static_type_param.phpt15
-rw-r--r--Zend/tests/type_declarations/static_type_property.phpt13
-rw-r--r--Zend/tests/type_declarations/static_type_return.phpt91
-rw-r--r--Zend/tests/type_declarations/static_type_trait.phpt38
-rw-r--r--Zend/tests/type_declarations/strict_call_weak.phpt2
-rw-r--r--Zend/tests/type_declarations/strict_call_weak_explicit.phpt2
-rw-r--r--Zend/tests/type_declarations/strict_include_explicit_weak.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_001.phpt28
-rw-r--r--Zend/tests/type_declarations/typed_properties_002.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_003.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_004.phpt14
-rw-r--r--Zend/tests/type_declarations/typed_properties_005.phpt14
-rw-r--r--Zend/tests/type_declarations/typed_properties_006.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_007.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_008.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_009.phpt12
-rw-r--r--Zend/tests/type_declarations/typed_properties_010.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_011.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_012.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_013.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_014.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_015.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_016.phpt8
-rw-r--r--Zend/tests/type_declarations/typed_properties_017.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_018.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_020.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_021.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_022.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_023.phpt8
-rw-r--r--Zend/tests/type_declarations/typed_properties_024.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_025.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_026.phpt1
-rw-r--r--Zend/tests/type_declarations/typed_properties_027.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_028.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_029.phpt6
-rw-r--r--Zend/tests/type_declarations/typed_properties_030.phpt12
-rw-r--r--Zend/tests/type_declarations/typed_properties_031.phpt1
-rw-r--r--Zend/tests/type_declarations/typed_properties_032.phpt9
-rw-r--r--Zend/tests/type_declarations/typed_properties_033.phpt26
-rw-r--r--Zend/tests/type_declarations/typed_properties_034.phpt28
-rw-r--r--Zend/tests/type_declarations/typed_properties_035.phpt1
-rw-r--r--Zend/tests/type_declarations/typed_properties_036.phpt6
-rw-r--r--Zend/tests/type_declarations/typed_properties_037.phpt3
-rw-r--r--Zend/tests/type_declarations/typed_properties_038.phpt23
-rw-r--r--Zend/tests/type_declarations/typed_properties_039.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_040.phpt10
-rw-r--r--Zend/tests/type_declarations/typed_properties_041.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_042.phpt6
-rw-r--r--Zend/tests/type_declarations/typed_properties_043.phpt6
-rw-r--r--Zend/tests/type_declarations/typed_properties_044.phpt18
-rw-r--r--Zend/tests/type_declarations/typed_properties_046.phpt27
-rw-r--r--Zend/tests/type_declarations/typed_properties_047.phpt12
-rw-r--r--Zend/tests/type_declarations/typed_properties_048.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_049.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_051.phpt14
-rw-r--r--Zend/tests/type_declarations/typed_properties_052.phpt12
-rw-r--r--Zend/tests/type_declarations/typed_properties_053.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_054.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_055.phpt10
-rw-r--r--Zend/tests/type_declarations/typed_properties_056.phpt8
-rw-r--r--Zend/tests/type_declarations/typed_properties_057.phpt10
-rw-r--r--Zend/tests/type_declarations/typed_properties_058.phpt20
-rw-r--r--Zend/tests/type_declarations/typed_properties_059.phpt10
-rw-r--r--Zend/tests/type_declarations/typed_properties_060.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_061.phpt14
-rw-r--r--Zend/tests/type_declarations/typed_properties_062.phpt16
-rw-r--r--Zend/tests/type_declarations/typed_properties_063.phpt14
-rw-r--r--Zend/tests/type_declarations/typed_properties_064.phpt12
-rw-r--r--Zend/tests/type_declarations/typed_properties_065.phpt24
-rw-r--r--Zend/tests/type_declarations/typed_properties_066.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_067.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_068.phpt24
-rw-r--r--Zend/tests/type_declarations/typed_properties_069.phpt12
-rw-r--r--Zend/tests/type_declarations/typed_properties_070.phpt20
-rw-r--r--Zend/tests/type_declarations/typed_properties_071.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_072.phpt10
-rw-r--r--Zend/tests/type_declarations/typed_properties_073.phpt12
-rw-r--r--Zend/tests/type_declarations/typed_properties_074.phpt16
-rw-r--r--Zend/tests/type_declarations/typed_properties_075.phpt22
-rw-r--r--Zend/tests/type_declarations/typed_properties_078.phpt16
-rw-r--r--Zend/tests/type_declarations/typed_properties_079.phpt8
-rw-r--r--Zend/tests/type_declarations/typed_properties_081.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_082.phpt6
-rw-r--r--Zend/tests/type_declarations/typed_properties_084.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_086.phpt6
-rw-r--r--Zend/tests/type_declarations/typed_properties_089.phpt16
-rw-r--r--Zend/tests/type_declarations/typed_properties_090.phpt16
-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.phpt18
-rw-r--r--Zend/tests/type_declarations/typed_properties_096.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_100.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_103.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_104.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_class_loading.phpt4
-rw-r--r--Zend/tests/type_declarations/typed_properties_reference_coercion_leak.phpt22
-rw-r--r--Zend/tests/type_declarations/types_in_ast.phpt10
-rw-r--r--Zend/tests/type_declarations/union_types/anonymous_class.phpt30
-rw-r--r--Zend/tests/type_declarations/union_types/generator_return_containing_extra_types.phpt21
-rw-r--r--Zend/tests/type_declarations/union_types/generator_return_multiple_classes.phpt18
-rw-r--r--Zend/tests/type_declarations/union_types/illegal_default_value_argument.phpt11
-rw-r--r--Zend/tests/type_declarations/union_types/illegal_default_value_property.phpt12
-rw-r--r--Zend/tests/type_declarations/union_types/incdec_prop.phpt132
-rw-r--r--Zend/tests/type_declarations/union_types/inheritance.phpt46
-rw-r--r--Zend/tests/type_declarations/union_types/inheritance_internal.phpt33
-rw-r--r--Zend/tests/type_declarations/union_types/legal_default_values.phpt45
-rw-r--r--Zend/tests/type_declarations/union_types/multiple_classes.phpt83
-rw-r--r--Zend/tests/type_declarations/union_types/prop_ref_assign.phpt59
-rw-r--r--Zend/tests/type_declarations/union_types/redundant_types/bool_and_false.phpt11
-rw-r--r--Zend/tests/type_declarations/union_types/redundant_types/duplicate_class_type.phpt11
-rw-r--r--Zend/tests/type_declarations/union_types/redundant_types/duplicate_type.phpt11
-rw-r--r--Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable.phpt11
-rw-r--r--Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable_2.phpt11
-rw-r--r--Zend/tests/type_declarations/union_types/redundant_types/iterable_and_array.phpt11
-rw-r--r--Zend/tests/type_declarations/union_types/redundant_types/nullable_null.phpt11
-rw-r--r--Zend/tests/type_declarations/union_types/redundant_types/object_and_class_type.phpt11
-rw-r--r--Zend/tests/type_declarations/union_types/redundant_types/object_and_static.phpt12
-rw-r--r--Zend/tests/type_declarations/union_types/standalone_false.phpt10
-rw-r--r--Zend/tests/type_declarations/union_types/standalone_null.phpt10
-rw-r--r--Zend/tests/type_declarations/union_types/standalone_nullable_false.phpt10
-rw-r--r--Zend/tests/type_declarations/union_types/type_checking_strict.phpt207
-rw-r--r--Zend/tests/type_declarations/union_types/type_checking_weak.phpt205
-rw-r--r--Zend/tests/type_declarations/union_types/variance/invalid_001.phpt15
-rw-r--r--Zend/tests/type_declarations/union_types/variance/invalid_002.phpt15
-rw-r--r--Zend/tests/type_declarations/union_types/variance/invalid_003.phpt18
-rw-r--r--Zend/tests/type_declarations/union_types/variance/invalid_004.phpt13
-rw-r--r--Zend/tests/type_declarations/union_types/variance/valid.phpt31
-rw-r--r--Zend/tests/type_declarations/union_types/void_with_class.phpt10
-rw-r--r--Zend/tests/type_declarations/variance/class_order_autoload1.phpt2
-rw-r--r--Zend/tests/type_declarations/variance/class_order_autoload2.phpt2
-rw-r--r--Zend/tests/type_declarations/variance/class_order_autoload3.phpt2
-rw-r--r--Zend/tests/type_declarations/variance/class_order_autoload4.phpt2
-rw-r--r--Zend/tests/type_declarations/variance/class_order_autoload5.phpt2
-rw-r--r--Zend/tests/type_declarations/variance/class_order_autoload_error2.phpt2
-rw-r--r--Zend/tests/type_declarations/variance/class_order_autoload_error5.phpt10
-rw-r--r--Zend/tests/type_declarations/variance/infinite_recursion.phpt17
-rw-r--r--Zend/tests/type_declarations/variance/internal_parent.phpt4
-rw-r--r--Zend/tests/type_declarations/variance/loading_exception1.phpt5
-rw-r--r--Zend/tests/type_declarations/variance/loading_exception2.phpt5
-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/static_variance_failure.phpt15
-rw-r--r--Zend/tests/type_declarations/variance/static_variance_success.phpt25
-rw-r--r--Zend/tests/type_declarations/variance/stringable.phpt17
-rw-r--r--Zend/tests/type_declarations/variance/unlinked_parent_1.phpt2
-rw-r--r--Zend/tests/type_declarations/variance/unlinked_parent_2.phpt2
-rw-r--r--Zend/tests/type_declarations/weak_include_strict.phpt2
-rw-r--r--Zend/tests/typehints/bug76198.phpt2
-rw-r--r--Zend/tests/typehints/fully_qualified_scalar.phpt2
-rw-r--r--Zend/tests/typehints/or_null.phpt48
-rw-r--r--Zend/tests/undef_index_to_exception.phpt8
-rw-r--r--Zend/tests/undef_var_in_verify_return.phpt23
-rw-r--r--Zend/tests/unexpected_ref_bug.phpt11
-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_cv06.phpt2
-rw-r--r--Zend/tests/unset_cv09.phpt2
-rw-r--r--Zend/tests/unset_cv10.phpt2
-rw-r--r--Zend/tests/unterminated_comment.phpt8
-rw-r--r--Zend/tests/use_const/no_global_fallback.phpt2
-rw-r--r--Zend/tests/use_function/no_global_fallback2.phpt10
-rw-r--r--Zend/tests/use_unlinked_class.phpt7
-rw-r--r--Zend/tests/varSyntax/class_constant_static_deref.phpt27
-rw-r--r--Zend/tests/varSyntax/constant_object_deref.phpt24
-rw-r--r--Zend/tests/varSyntax/encapsed_string_deref.phpt29
-rw-r--r--Zend/tests/varSyntax/globalNonSimpleVariableError.phpt2
-rw-r--r--Zend/tests/varSyntax/magic_const_deref.phpt24
-rw-r--r--Zend/tests/varSyntax/newVariable.phpt4
-rw-r--r--Zend/tests/varSyntax/new_instanceof_expr.phpt18
-rw-r--r--Zend/tests/varSyntax/propertyOfStringError.phpt2
-rw-r--r--Zend/tests/variadic/adding_additional_optional_parameter_error.phpt2
-rw-r--r--Zend/tests/variadic/by_ref_error.phpt5
-rw-r--r--Zend/tests/variadic/illegal_variadic_override_ref.phpt16
-rw-r--r--Zend/tests/variadic/illegal_variadic_override_type.phpt16
-rw-r--r--Zend/tests/variadic/legal_variadic_override.phpt25
-rw-r--r--Zend/tests/variadic/optional_params.phpt2
-rw-r--r--Zend/tests/variadic/removing_parameter_error.phpt11
-rw-r--r--Zend/tests/variadic/typehint_error.phpt2
-rw-r--r--Zend/tests/variadic/typehint_suppressed_error.phpt6
-rw-r--r--Zend/tests/vm_stack_with_arg_extend.phpt8
-rw-r--r--Zend/tests/warning_during_heredoc_scan_ahead.phpt8
-rw-r--r--Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt176
-rw-r--r--Zend/tests/weakrefs/weakmap_error_conditions.phpt92
-rw-r--r--Zend/tests/weakrefs/weakmap_iteration.phpt80
-rw-r--r--Zend/tests/weakrefs/weakmap_multiple_weakrefs.phpt74
-rw-r--r--Zend/tests/weakrefs/weakmap_weakness.phpt128
-rw-r--r--Zend/tests/weakrefs/weakrefs_002.phpt4
-rw-r--r--Zend/tests/weakrefs/weakrefs_003.phpt41
-rw-r--r--Zend/tests/weakrefs/weakrefs_005.phpt2
-rw-r--r--Zend/tests/xor_001.phpt9
-rw-r--r--Zend/tests/zend_signed_multiply-64bit-2.phpt28
-rw-r--r--Zend/tests/zend_signed_multiply-64bit.phpt2
-rw-r--r--Zend/tests/zend_strtod.phpt4
2191 files changed, 25687 insertions, 12841 deletions
diff --git a/Zend/tests/001.phpt b/Zend/tests/001.phpt
index c7c2060dc2..0e27b48d65 100644
--- a/Zend/tests/001.phpt
+++ b/Zend/tests/001.phpt
@@ -4,56 +4,59 @@ func_num_args() tests
<?php
function test1() {
- var_dump(func_num_args());
+ var_dump(func_num_args());
}
function test2($a) {
- var_dump(func_num_args());
+ var_dump(func_num_args());
}
function test3($a, $b) {
- var_dump(func_num_args());
+ var_dump(func_num_args());
}
test1();
test2(1);
try {
- test2();
+ test2();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
test3(1,2);
call_user_func("test1");
try {
- call_user_func("test3", 1);
+ call_user_func("test3", 1);
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
call_user_func("test3", 1, 2);
class test {
- static function test1($a) {
- var_dump(func_num_args());
- }
+ static function test1($a) {
+ var_dump(func_num_args());
+ }
}
test::test1(1);
-var_dump(func_num_args());
+
+try {
+ func_num_args();
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Done\n";
?>
--EXPECTF--
int(0)
int(1)
-Exception: Too few arguments to function test2(), 0 passed in %s001.php on line 18 and exactly 1 expected
+Exception: Too few arguments to function test2(), 0 passed in %s on line %d and exactly 1 expected
int(2)
int(0)
-Exception: Too few arguments to function test3(), 1 passed in %s001.php on line 27 and exactly 2 expected
+Exception: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected
int(2)
int(1)
-
-Warning: func_num_args(): Called from the global scope - no function context in %s on line %d
-int(-1)
+func_num_args() must be called from a function context
Done
diff --git a/Zend/tests/002.phpt b/Zend/tests/002.phpt
index e89f71ef51..7c2ff7b4d3 100644
--- a/Zend/tests/002.phpt
+++ b/Zend/tests/002.phpt
@@ -4,98 +4,118 @@ func_get_arg() tests
<?php
function test1() {
- var_dump(func_get_arg(-10));
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
+ try {
+ var_dump(func_get_arg(-10));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+
+ try {
+ var_dump(func_get_arg(0));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ try {
+ var_dump(func_get_arg(1));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
function test2($a) {
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
+ try {
+ var_dump(func_get_arg(0));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ try {
+ var_dump(func_get_arg(1));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
function test3($a, $b) {
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
- var_dump(func_get_arg(2));
+ try {
+ var_dump(func_get_arg(0));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ try {
+ var_dump(func_get_arg(1));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ try {
+ var_dump(func_get_arg(2));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
test1();
test1(10);
test2(1);
try {
- test2();
+ test2();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
test3(1,2);
call_user_func("test1");
try {
- call_user_func("test3", 1);
+ call_user_func("test3", 1);
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
call_user_func("test3", 1, 2);
class test {
- static function test1($a) {
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
- }
+ static function test1($a) {
+ try {
+ var_dump(func_get_arg(0));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ try {
+ var_dump(func_get_arg(1));
+ } catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ }
}
test::test1(1);
-var_dump(func_get_arg(1));
+try {
+ var_dump(func_get_arg(1));
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "Done\n";
?>
--EXPECTF--
-Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
-bool(false)
+func_get_arg(): Argument #1 ($position) must be greater than or equal to 0
+func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
+func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
+func_get_arg(): Argument #1 ($position) must be greater than or equal to 0
int(10)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
+func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
int(1)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
+func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
Exception: Too few arguments to function test2(), 0 passed in %s002.php on line %d and exactly 1 expected
int(1)
int(2)
-
-Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
-Exception: Too few arguments to function test3(), 1 passed in %s002.php on line %d and exactly 2 expected
+func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
+func_get_arg(): Argument #1 ($position) must be greater than or equal to 0
+func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
+func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
+Exception: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected
int(1)
int(2)
-
-Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
-bool(false)
+func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
int(1)
-
-Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
-bool(false)
-
-Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
-bool(false)
+func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
+func_get_arg() cannot be called from the global scope
Done
diff --git a/Zend/tests/003.phpt b/Zend/tests/003.phpt
index b1ef79ebcb..3931628e9a 100644
--- a/Zend/tests/003.phpt
+++ b/Zend/tests/003.phpt
@@ -4,45 +4,49 @@ func_get_args() tests
<?php
function test1() {
- var_dump(func_get_args());
+ var_dump(func_get_args());
}
function test2($a) {
- var_dump(func_get_args());
+ var_dump(func_get_args());
}
function test3($a, $b) {
- var_dump(func_get_args());
+ var_dump(func_get_args());
}
test1();
test1(10);
test2(1);
try {
- test2();
+ test2();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
test3(1,2);
call_user_func("test1");
try {
- call_user_func("test3", 1);
+ call_user_func("test3", 1);
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
call_user_func("test3", 1, 2);
class test {
- static function test1($a) {
- var_dump(func_get_args());
- }
+ static function test1($a) {
+ var_dump(func_get_args());
+ }
}
test::test1(1);
-var_dump(func_get_args());
-echo "Done\n";
+try {
+ var_dump(func_get_args());
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
?>
--EXPECTF--
array(0) {
@@ -75,7 +79,4 @@ array(1) {
[0]=>
int(1)
}
-
-Warning: func_get_args(): Called from the global scope - no function context in %s on line %d
-bool(false)
-Done
+func_get_args() cannot be called from the global scope
diff --git a/Zend/tests/004.phpt b/Zend/tests/004.phpt
index 179684d076..bb40946f24 100644
--- a/Zend/tests/004.phpt
+++ b/Zend/tests/004.phpt
@@ -3,23 +3,20 @@ strncmp() tests
--FILE--
<?php
-var_dump(strncmp("", ""));
var_dump(strncmp("", "", 100));
-var_dump(strncmp("aef", "dfsgbdf", -1));
+try {
+ var_dump(strncmp("aef", "dfsgbdf", -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump(strncmp("fghjkl", "qwer", 0));
var_dump(strncmp("qwerty", "qwerty123", 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
+--EXPECT--
int(0)
-
-Warning: Length must be greater than or equal to 0 in %s on line %d
-bool(false)
+strncmp(): Argument #3 ($length) must be greater than or equal to 0
int(0)
int(0)
int(-1)
-Done
diff --git a/Zend/tests/005.phpt b/Zend/tests/005.phpt
index 6ad1b0f63d..413f3205ad 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"));
@@ -14,9 +13,7 @@ var_dump(strcasecmp("01", "01"));
echo "Done\n";
?>
---EXPECTF--
-Warning: strcasecmp() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
+--EXPECT--
int(0)
int(-3)
int(-1)
diff --git a/Zend/tests/006.phpt b/Zend/tests/006.phpt
index 64c74ff134..ee6b567040 100644
--- a/Zend/tests/006.phpt
+++ b/Zend/tests/006.phpt
@@ -3,8 +3,12 @@ strncasecmp() tests
--FILE--
<?php
-var_dump(strncasecmp(""));
-var_dump(strncasecmp("", "", -1));
+try {
+ var_dump(strncasecmp("", "", -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
var_dump(strncasecmp("aef", "dfsgbdf", 0));
var_dump(strncasecmp("aef", "dfsgbdf", 10));
var_dump(strncasecmp("qwe", "qwer", 3));
@@ -13,14 +17,9 @@ var_dump(strncasecmp("qwErtY", "qwer", 7));
var_dump(strncasecmp("q123", "Q123", 3));
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)
+--EXPECT--
+strncasecmp(): Argument #3 ($length) must be greater than or equal to 0
int(0)
int(-3)
int(0)
@@ -28,4 +27,3 @@ int(0)
int(2)
int(0)
int(0)
-Done
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..1057c82b95 100644
--- a/Zend/tests/008.phpt
+++ b/Zend/tests/008.phpt
@@ -3,19 +3,25 @@ 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));
var_dump(define("test const", 3));
var_dump(define("test", array(1)));
var_dump(define("test1", fopen(__FILE__, 'r')));
+
+try {
var_dump(define("test2", new stdclass));
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
var_dump(constant(" "));
var_dump(constant("[[["));
@@ -24,29 +30,19 @@ 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)
+TypeError: define(): Argument #1 ($constant_name) must be of type string, array given
-Warning: define() expects parameter 3 to be bool, array given in %s on line %d
-NULL
-
-Warning: define() expects parameter 1 to be string, array given in %s on line %d
-NULL
+Warning: Constant TRUE already defined in %s on line %d
+bool(false)
bool(true)
bool(true)
bool(true)
-Notice: Constant test const already defined in %s on line %d
+Warning: Constant test const already defined in %s on line %d
bool(false)
bool(true)
bool(true)
-
-Warning: Constants may only evaluate to scalar values, arrays or resources in %s on line %d
-bool(false)
+define(): Argument #2 ($value) cannot be an object, stdClass given
int(1)
int(2)
int(3)
diff --git a/Zend/tests/009.phpt b/Zend/tests/009.phpt
index 82cfabee49..ddf38e96f4 100644
--- a/Zend/tests/009.phpt
+++ b/Zend/tests/009.phpt
@@ -4,29 +4,38 @@ get_class() tests
<?php
class foo {
- function bar () {
- var_dump(get_class());
- }
+ function bar () {
+ var_dump(get_class());
+ }
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;
$f1->bar();
$f2->bar();
-var_dump(get_class());
-var_dump(get_class("qwerty"));
+try {
+ var_dump(get_class());
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(get_class("qwerty"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(get_class($f1));
var_dump(get_class($f2));
@@ -35,23 +44,12 @@ $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
+--EXPECT--
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() without arguments must be called from within a class
+get_class(): Argument #1 ($object) must be of type 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(): Argument #1 ($object) must be of type object, null given
Done
diff --git a/Zend/tests/010.phpt b/Zend/tests/010.phpt
index eef3bc594f..467c7d9efc 100644
--- a/Zend/tests/010.phpt
+++ b/Zend/tests/010.phpt
@@ -4,19 +4,19 @@ get_parent_class() tests
<?php
interface i {
- function test();
+ function test();
}
class foo implements i {
- function test() {
- var_dump(get_parent_class());
- }
+ function test() {
+ var_dump(get_parent_class());
+ }
}
class bar extends foo {
- function test_bar() {
- var_dump(get_parent_class());
- }
+ function test_bar() {
+ var_dump(get_parent_class());
+ }
}
$bar = new bar;
@@ -32,12 +32,37 @@ var_dump(get_parent_class("bar"));
var_dump(get_parent_class("foo"));
var_dump(get_parent_class("i"));
-var_dump(get_parent_class(""));
-var_dump(get_parent_class("[[[["));
-var_dump(get_parent_class(" "));
+try {
+ get_parent_class("");
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ get_parent_class("[[[[");
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ get_parent_class(" ");
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
var_dump(get_parent_class(new stdclass));
-var_dump(get_parent_class(array()));
-var_dump(get_parent_class(1));
+
+try {
+ get_parent_class(array());
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ get_parent_class(1);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Done\n";
?>
@@ -50,10 +75,10 @@ bool(false)
string(3) "foo"
bool(false)
bool(false)
+get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
+get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
+get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
+get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, array given
+get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, int given
Done
diff --git a/Zend/tests/011.phpt b/Zend/tests/011.phpt
index 7bcab0798f..0a7e3fd90a 100644
--- a/Zend/tests/011.phpt
+++ b/Zend/tests/011.phpt
@@ -4,27 +4,25 @@ property_exists() tests
<?php
class foo {
- public $pp1 = 1;
- private $pp2 = 2;
- protected $pp3 = 3;
+ public $pp1 = 1;
+ private $pp2 = 2;
+ protected $pp3 = 3;
- function bar() {
- var_dump(property_exists("foo","pp1"));
- var_dump(property_exists("foo","pp2"));
- var_dump(property_exists("foo","pp3"));
- }
+ function bar() {
+ var_dump(property_exists("foo","pp1"));
+ var_dump(property_exists("foo","pp2"));
+ var_dump(property_exists("foo","pp3"));
+ }
}
class bar extends foo {
- function test() {
- var_dump(property_exists("foo","pp1"));
- var_dump(property_exists("foo","pp2"));
- var_dump(property_exists("foo","pp3"));
- }
+ function test() {
+ var_dump(property_exists("foo","pp1"));
+ var_dump(property_exists("foo","pp2"));
+ var_dump(property_exists("foo","pp3"));
+ }
}
-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"));
@@ -41,23 +39,40 @@ var_dump(property_exists($foo,"pp2"));
var_dump(property_exists($foo,"pp3"));
var_dump(property_exists($foo,"nonexistent"));
var_dump(property_exists($foo,""));
-var_dump(property_exists(array(),"test"));
-var_dump(property_exists(1,"test"));
-var_dump(property_exists(true,"test"));
+
+try {
+ var_dump(property_exists(array(), "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(property_exists(1, "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(property_exists(3.14, "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(property_exists(true, "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(property_exists(null, "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$foo->bar();
$bar = new bar;
$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
+--EXPECT--
bool(true)
bool(true)
bool(true)
@@ -71,19 +86,14 @@ bool(true)
bool(true)
bool(false)
bool(false)
-
-Warning: First parameter must either be an object or the name of an existing class in %s on line %d
-NULL
-
-Warning: First parameter must either be an object or the name of an existing class in %s on line %d
-NULL
-
-Warning: First parameter must either be an object or the name of an existing class in %s on line %d
-NULL
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, array given
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, int given
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, float given
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, bool given
+property_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
-Done
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..d492590bcd 100644
--- a/Zend/tests/015.phpt
+++ b/Zend/tests/015.phpt
@@ -3,35 +3,31 @@ 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));
+
+try {
+ var_dump(trigger_error("error", -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(trigger_error("error", 0));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
var_dump(trigger_error("error", E_USER_WARNING));
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)
-
-Warning: Invalid error type specified in %s on line %d
-bool(false)
+trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
+trigger_error(): Argument #2 ($error_level) must be one of E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE, or E_USER_DEPRECATED
Warning: error in %s on line %d
bool(true)
Deprecated: error in %s on line %d
bool(true)
-Done
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..f348c2b556 100644
--- a/Zend/tests/018.phpt
+++ b/Zend/tests/018.phpt
@@ -3,11 +3,11 @@ constant() tests
--FILE--
<?php
-var_dump(constant());
-var_dump(constant("", ""));
-var_dump(constant(""));
-
-var_dump(constant(array()));
+try {
+ var_dump(constant(""));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
define("TEST_CONST", 1);
var_dump(constant("TEST_CONST"));
@@ -17,18 +17,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
+--EXPECT--
+Undefined constant ""
int(1)
string(4) "test"
Done
diff --git a/Zend/tests/019.phpt b/Zend/tests/019.phpt
index cde590734f..bab02dd565 100644
--- a/Zend/tests/019.phpt
+++ b/Zend/tests/019.phpt
@@ -2,16 +2,6 @@
Test unset(), empty() and isset() functions
--FILE--
<?php
-/* Prototype: void unset ( mixed $var [, mixed $var [, mixed $...]] );
- Description: unset() destroys the specified variables
-
- Prototype: bool empty( mixed $var );
- Description: Determine whether a variable is considered to be empty
-
- Prototype: bool isset ( mixed $var [, mixed $var [, $...]] );
- Description: Returns TRUE if var exists; FALSE otherwise
-*/
-
echo "*** Testing unset(), empty() & isset() with scalar variables ***\n";
// testing scalar variables
@@ -243,7 +233,7 @@ var_dump( empty($point1->x) ); // expected: bool(true)
// unset all members and check
unset($point1->y);
unset($point1->lable);
-// dump the objec to check that all variables are unset
+// dump the object to check that all variables are unset
var_dump($point1);
var_dump( isset($point1) ); // expected: bool(ture)
var_dump( empty($point1) ); // expected: bool(false)
@@ -360,7 +350,6 @@ var_dump($global_var);
//Note: No error conditions relating to passing arguments can be tested
// because these are not functions but statements, it will result in syntax error.
?>
-===DONE===
--EXPECTF--
*** Testing unset(), empty() & isset() with scalar variables ***
-- Iteration 1 --
@@ -368,7 +357,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 +369,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 +381,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 +393,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 +405,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 +417,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 +429,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 +441,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 +453,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 +465,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 +477,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 +489,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 +501,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 +513,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 +525,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 +537,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 +549,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 +561,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 +573,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 +585,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 +597,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 +609,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 +621,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 +633,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 +645,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 +657,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 +669,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 +686,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 +702,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 +729,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 +756,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 +783,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 +816,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 +840,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 +860,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 +876,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 +907,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 +927,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 +943,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 +972,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 +988,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 +1017,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 +1033,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 +1068,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 +1096,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 +1120,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 +1140,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 +1156,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 +1185,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 +1198,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 +1218,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 +1252,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 +1282,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 +1291,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 +1300,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)
@@ -1330,4 +1319,3 @@ bool(false)
bool(false)
bool(true)
int(10)
-===DONE===
diff --git a/Zend/tests/020.phpt b/Zend/tests/020.phpt
index 1e2bcff387..13e0443c07 100644
--- a/Zend/tests/020.phpt
+++ b/Zend/tests/020.phpt
@@ -3,32 +3,27 @@ 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());
+try {
+ var_dump(func_get_arg(1));
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
function bar() {
- var_dump(func_get_arg(1));
+ var_dump(func_get_arg(1));
}
function foo() {
- bar(func_get_arg(1));
+ bar(func_get_arg(1));
}
-foo(1,2);
+try {
+ foo(1,2);
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
-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
+--EXPECT--
+func_get_arg() cannot be called from the global scope
+func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
diff --git a/Zend/tests/022.phpt b/Zend/tests/022.phpt
index 1226e2719f..43353c3a01 100644
--- a/Zend/tests/022.phpt
+++ b/Zend/tests/022.phpt
@@ -1,24 +1,25 @@
--TEST--
-Implementating abstracting methods and optional parameters
+Implementing abstracting methods and optional parameters
--FILE--
<?php
abstract class Base
{
- abstract function someMethod($param);
+ abstract function someMethod($param);
}
class Ext extends Base
{
- function someMethod($param = "default")
- {
- echo $param, "\n";
- }
+ function someMethod($param = "default")
+ {
+ echo $param, "\n";
+ }
}
$a = new Ext();
$a->someMethod("foo");
$a->someMethod();
+?>
--EXPECT--
foo
default
diff --git a/Zend/tests/023.phpt b/Zend/tests/023.phpt
index 6f975c655b..b96433fd66 100644
--- a/Zend/tests/023.phpt
+++ b/Zend/tests/023.phpt
@@ -10,20 +10,20 @@ print "\n";
class bar {
- public function a() {
- return "bar!";
- }
+ public function a() {
+ return "bar!";
+ }
}
class foo {
- public function test() {
- print "foo!\n";
- return new bar;
- }
+ public function test() {
+ print "foo!\n";
+ return new bar;
+ }
}
function test() {
- return new foo;
+ return new foo;
}
$a = 'test';
diff --git a/Zend/tests/024.phpt b/Zend/tests/024.phpt
index 9e647d4231..22d93483fe 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: Attempt to read property "1" on int in %s on line %d
NULL
-Notice: Trying to get property '1' of non-object in %s on line %d
+Warning: Attempt to read property "1" on int 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: Attempt to read property "1" on int in %s on line %d
-Notice: Trying to get property '' of non-object in %s on line %d
+Warning: Attempt to read property "" on null in %s on line %d
NULL
diff --git a/Zend/tests/025.phpt b/Zend/tests/025.phpt
index 24e5520ee1..0d3c7e823e 100644
--- a/Zend/tests/025.phpt
+++ b/Zend/tests/025.phpt
@@ -4,9 +4,9 @@ Testing dynamic calls
<?php
class foo {
- static public function a() {
- print "ok\n";
- }
+ static public function a() {
+ print "ok\n";
+ }
}
$a = 'a';
diff --git a/Zend/tests/026.phpt b/Zend/tests/026.phpt
index b3088e8473..fff2c99f62 100644
--- a/Zend/tests/026.phpt
+++ b/Zend/tests/026.phpt
@@ -4,8 +4,8 @@ Trying assign value to property when an object is not returned in a function
<?php
class foo {
- public function a() {
- }
+ public function a() {
+ }
}
$test = new foo;
@@ -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: Attempt to read property "a" on null in %s on line %d
ok
-
-Warning: Creating default object from empty value in %s on line %d
+Attempt to assign property "a" on null
ok
diff --git a/Zend/tests/028.phpt b/Zend/tests/028.phpt
index 24dafffc68..b54e533ac1 100644
--- a/Zend/tests/028.phpt
+++ b/Zend/tests/028.phpt
@@ -18,9 +18,9 @@ bool(true)
bool(true)
bool(true)
-Notice: Undefined offset: 2 in %s on line %d
+Warning: Undefined array key 2 in %s on line %d
-Fatal error: Uncaught Error: Function name must be a string in %s:%d
+Fatal error: Uncaught Error: Value of type null is not callable in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/030.phpt b/Zend/tests/030.phpt
index 6f3bda27d7..fb67ef0c9d 100644
--- a/Zend/tests/030.phpt
+++ b/Zend/tests/030.phpt
@@ -4,26 +4,26 @@ Overriding $this in catch and checking the object properties later.
<?php
class foo {
- public $test = 0;
- private $test_2 = 1;
- protected $test_3 = 2;
+ public $test = 0;
+ private $test_2 = 1;
+ protected $test_3 = 2;
- public function bar() {
- try {
- throw new Exception('foo');
- } catch (Exception $this) {
- var_dump($this);
- }
+ public function bar() {
+ try {
+ throw new Exception('foo');
+ } catch (Exception $this) {
+ var_dump($this);
+ }
- $this->baz();
- }
+ $this->baz();
+ }
- public function baz() {
- foreach ($this as $k => $v) {
- printf("'%s' => '%s'\n", $k, $v);
- }
- print "ok\n";
- }
+ public function baz() {
+ foreach ($this as $k => $v) {
+ printf("'%s' => '%s'\n", $k, $v);
+ }
+ print "ok\n";
+ }
}
$test = new foo;
diff --git a/Zend/tests/033.phpt b/Zend/tests/033.phpt
index 1e7fca1e0d..22e4b6a120 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: Attempt to read property "foo" on null in %s on line %d
+Attempt to assign property "foo" on null
+Attempt to assign property "bar" on null
diff --git a/Zend/tests/034.phpt b/Zend/tests/034.phpt
index 132fbf78f5..c608ef96c9 100644
--- a/Zend/tests/034.phpt
+++ b/Zend/tests/034.phpt
@@ -4,21 +4,21 @@ Testing multiples 'default:' in switch
<?php
switch (1) {
- case 2:
- print 'foo';
- break;
- case 3:
- print 'bar';
- break;
- default:
- print 1;
- break;
- default:
- print 2;
- break;
- default:
- print 3;
- break;
+ case 2:
+ print 'foo';
+ break;
+ case 3:
+ print 'bar';
+ break;
+ default:
+ print 1;
+ break;
+ default:
+ print 2;
+ break;
+ default:
+ print 3;
+ break;
}
?>
diff --git a/Zend/tests/036.phpt b/Zend/tests/036.phpt
index 3ff522b16f..8f74bccc07 100644
--- a/Zend/tests/036.phpt
+++ b/Zend/tests/036.phpt
@@ -3,14 +3,12 @@ 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";
+}
?>
---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
+--EXPECT--
+Illegal offset type
diff --git a/Zend/tests/037.phpt b/Zend/tests/037.phpt
index ef70310e6d..7fe8b2f6bf 100644
--- a/Zend/tests/037.phpt
+++ b/Zend/tests/037.phpt
@@ -16,7 +16,7 @@ var_dump($x::$x);
--EXPECTF--
int(1)
-Fatal error: Uncaught Error: Access to undeclared static property: Closure::$x in %s:%d
+Fatal error: Uncaught Error: Access to undeclared static property Closure::$x in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
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/ErrorException_construct.phpt b/Zend/tests/ErrorException_construct.phpt
new file mode 100644
index 0000000000..7304af3da0
--- /dev/null
+++ b/Zend/tests/ErrorException_construct.phpt
@@ -0,0 +1,63 @@
+--TEST--
+Test default value handling of ErrorException::__construct()
+--FILE--
+<?php
+
+$e = new ErrorException();
+var_dump($e->getMessage());
+var_dump($e->getFile());
+var_dump($e->getLine());
+
+$e = new ErrorException("Second", 0, E_ERROR, null);
+var_dump($e->getMessage());
+var_dump($e->getFile());
+var_dump($e->getLine());
+
+$e = new ErrorException("Third", 0, E_ERROR, null, null);
+var_dump($e->getMessage());
+var_dump($e->getFile());
+var_dump($e->getLine());
+
+$e = new ErrorException("Forth", 0, E_ERROR, null, 123);
+var_dump($e->getMessage());
+var_dump($e->getFile());
+var_dump($e->getLine());
+
+$e = new ErrorException("Fifth", 0, E_ERROR, "abc.php");
+var_dump($e->getMessage());
+var_dump($e->getFile());
+var_dump($e->getLine());
+
+$e = new ErrorException("Sixth", 0, E_ERROR, "abc.php", null);
+var_dump($e->getMessage());
+var_dump($e->getFile());
+var_dump($e->getLine());
+
+$e = new ErrorException("Seventh", 0, E_ERROR, "abc.php", 123);
+var_dump($e->getMessage());
+var_dump($e->getFile());
+var_dump($e->getLine());
+
+?>
+--EXPECTF--
+string(0) ""
+string(%d) "%sErrorException_construct.php"
+int(3)
+string(6) "Second"
+string(%d) "%sErrorException_construct.php"
+int(8)
+string(5) "Third"
+string(%d) "%sErrorException_construct.php"
+int(13)
+string(5) "Forth"
+string(%d) "%sErrorException_construct.php"
+int(123)
+string(5) "Fifth"
+string(7) "abc.php"
+int(0)
+string(5) "Sixth"
+string(7) "abc.php"
+int(0)
+string(7) "Seventh"
+string(7) "abc.php"
+int(123)
diff --git a/Zend/tests/access_modifiers_001.phpt b/Zend/tests/access_modifiers_001.phpt
index f89d55bd93..6ffb40eb6d 100644
--- a/Zend/tests/access_modifiers_001.phpt
+++ b/Zend/tests/access_modifiers_001.phpt
@@ -4,8 +4,8 @@ using multiple access modifiers (methods)
<?php
class test {
- static public public static final public final function foo() {
- }
+ static public public static final public final function foo() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/access_modifiers_002.phpt b/Zend/tests/access_modifiers_002.phpt
index f0b15e43dc..9830258c61 100644
--- a/Zend/tests/access_modifiers_002.phpt
+++ b/Zend/tests/access_modifiers_002.phpt
@@ -4,7 +4,7 @@ using multiple access modifiers (attributes)
<?php
class test {
- static public public static final public final $var;
+ static public public static final public final $var;
}
echo "Done\n";
diff --git a/Zend/tests/access_modifiers_003.phpt b/Zend/tests/access_modifiers_003.phpt
index 7f5d922f3b..296aac07bb 100644
--- a/Zend/tests/access_modifiers_003.phpt
+++ b/Zend/tests/access_modifiers_003.phpt
@@ -4,7 +4,7 @@ using multiple access modifiers (classes)
<?php
final final class test {
- function foo() {}
+ function foo() {}
}
echo "Done\n";
diff --git a/Zend/tests/access_modifiers_004.phpt b/Zend/tests/access_modifiers_004.phpt
index 2be203a917..2abff66c1d 100644
--- a/Zend/tests/access_modifiers_004.phpt
+++ b/Zend/tests/access_modifiers_004.phpt
@@ -4,8 +4,8 @@ using multiple access modifiers (abstract methods)
<?php
class test {
- abstract abstract function foo() {
- }
+ abstract abstract function foo() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/access_modifiers_005.phpt b/Zend/tests/access_modifiers_005.phpt
index 7780cf4ca6..6569402be1 100644
--- a/Zend/tests/access_modifiers_005.phpt
+++ b/Zend/tests/access_modifiers_005.phpt
@@ -4,8 +4,8 @@ using multiple access modifiers (final methods)
<?php
class test {
- final final function foo() {
- }
+ final final function foo() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/access_modifiers_006.phpt b/Zend/tests/access_modifiers_006.phpt
index aefe27c68a..102276aba1 100644
--- a/Zend/tests/access_modifiers_006.phpt
+++ b/Zend/tests/access_modifiers_006.phpt
@@ -4,8 +4,8 @@ using multiple access modifiers (static methods)
<?php
class test {
- static static function foo() {
- }
+ static static function foo() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/access_modifiers_007.phpt b/Zend/tests/access_modifiers_007.phpt
index 4860c52c29..a34e1940d5 100644
--- a/Zend/tests/access_modifiers_007.phpt
+++ b/Zend/tests/access_modifiers_007.phpt
@@ -4,7 +4,7 @@ abstract final methods errmsg
<?php
class test {
- final abstract function foo();
+ final abstract function foo();
}
echo "Done\n";
diff --git a/Zend/tests/access_modifiers_008.phpt b/Zend/tests/access_modifiers_008.phpt
index 67886cfa7e..70e789e99d 100644
--- a/Zend/tests/access_modifiers_008.phpt
+++ b/Zend/tests/access_modifiers_008.phpt
@@ -6,16 +6,16 @@ Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
<?php
class A {
- static protected function f() {return 'A::f()';}
+ static protected function f() {return 'A::f()';}
}
class B1 extends A {
- static protected function f() {return 'B1::f()';}
+ static protected function f() {return 'B1::f()';}
}
class B2 extends A {
- static public function test() {echo B1::f();}
+ static public function test() {echo B1::f();}
}
B2::test();
?>
--EXPECTF--
-Fatal error: Call to protected method B1::f() from context 'B2' in %s on line %d
+Fatal error: Call to protected method B1::f() from scope B2 in %s on line %d
diff --git a/Zend/tests/access_modifiers_009.phpt b/Zend/tests/access_modifiers_009.phpt
index cb01fa13fb..e36f609b9d 100644
--- a/Zend/tests/access_modifiers_009.phpt
+++ b/Zend/tests/access_modifiers_009.phpt
@@ -6,16 +6,16 @@ Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
<?php
class A {
- static protected function f() {return 'A::f()';}
+ static protected function f() {return 'A::f()';}
}
class B1 extends A {
- static protected function f() {return 'B1::f()';}
+ static protected function f() {return 'B1::f()';}
}
class B2 extends A {
- static public function test() {
- var_dump(is_callable('B1::f'));
- B1::f();
- }
+ static public function test() {
+ var_dump(is_callable('B1::f'));
+ B1::f();
+ }
}
B2::test();
@@ -23,4 +23,4 @@ B2::test();
--EXPECTF--
bool(false)
-Fatal error: Call to protected method B1::f() from context 'B2' in %s on line %d
+Fatal error: Call to protected method B1::f() from scope B2 in %s on line %d
diff --git a/Zend/tests/access_modifiers_010.phpt b/Zend/tests/access_modifiers_010.phpt
index dd2e3e36b9..815a03b17c 100644
--- a/Zend/tests/access_modifiers_010.phpt
+++ b/Zend/tests/access_modifiers_010.phpt
@@ -4,31 +4,31 @@ Testing visibility of methods
<?php
class d {
- private function test2() {
- print "Bar\n";
- }
+ private function test2() {
+ print "Bar\n";
+ }
}
abstract class a extends d {
- public function test() {
- $this->test2();
- }
+ public function test() {
+ $this->test2();
+ }
}
abstract class b extends a {
}
class c extends b {
- public function __construct() {
- $this->test();
- }
+ public function __construct() {
+ $this->test();
+ }
}
new c;
?>
--EXPECTF--
-Fatal error: Uncaught Error: Call to private method d::test2() from context 'a' in %s:%d
+Fatal error: Uncaught Error: Call to private method d::test2() from scope a in %s:%d
Stack trace:
#0 %s(%d): a->test()
#1 %s(%d): c->__construct()
diff --git a/Zend/tests/access_modifiers_011.phpt b/Zend/tests/access_modifiers_011.phpt
index 23846fc040..ef24df6431 100644
--- a/Zend/tests/access_modifiers_011.phpt
+++ b/Zend/tests/access_modifiers_011.phpt
@@ -4,25 +4,25 @@ __call() for private/protected methods
<?php
class A {
- private $var1 = 'var1 value';
- protected $var2 = 'var2 value';
+ private $var1 = 'var1 value';
+ protected $var2 = 'var2 value';
- private function func1()
- {
- return "in func1";
- }
- protected function func2()
- {
- return "in func2";
- }
- public function __get($var)
- {
- return $this->$var;
- }
- public function __call($func, array $args = array())
- {
- return call_user_func_array(array($this, $func), $args);
- }
+ private function func1()
+ {
+ return "in func1";
+ }
+ protected function func2()
+ {
+ return "in func2";
+ }
+ public function __get($var)
+ {
+ return $this->$var;
+ }
+ public function __call($func, array $args = array())
+ {
+ return call_user_func_array(array($this, $func), $args);
+ }
}
$a = new A();
diff --git a/Zend/tests/access_modifiers_012.phpt b/Zend/tests/access_modifiers_012.phpt
index 86f678634b..4d07102cf2 100644
--- a/Zend/tests/access_modifiers_012.phpt
+++ b/Zend/tests/access_modifiers_012.phpt
@@ -3,9 +3,9 @@ Trigger __call() in lieu of non visible methods when called via a callback.
--FILE--
<?php
class C {
- protected function prot() { }
- private function priv() { }
- public function __call($name, $args) {
+ protected function prot() { }
+ private function priv() { }
+ public function __call($name, $args) {
echo "In __call() for method $name()\n";
}
}
diff --git a/Zend/tests/access_modifiers_013.phpt b/Zend/tests/access_modifiers_013.phpt
index f9b72c1f52..3f1c3111ab 100644
--- a/Zend/tests/access_modifiers_013.phpt
+++ b/Zend/tests/access_modifiers_013.phpt
@@ -4,7 +4,7 @@ Prevent abstract and final in the same class declaration
<?php
final abstract class C {
- private function priv() { }
+ private function priv() { }
}
?>
diff --git a/Zend/tests/add_002.phpt b/Zend/tests/add_002.phpt
index de0a3e8a63..9077ece085 100644
--- a/Zend/tests/add_002.phpt
+++ b/Zend/tests/add_002.phpt
@@ -9,9 +9,9 @@ $o = new stdclass;
$o->prop = "value";
try {
- var_dump($a + $o);
+ var_dump($a + $o);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$c = $a + $o;
@@ -20,13 +20,9 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Notice: Object of class stdClass could not be converted to number in %sadd_002.php on line %d
+Exception: Unsupported operand types: array + stdClass
-Exception: Unsupported operand types
-
-Notice: Object of class stdClass could not be converted to number in %s on line %d
-
-Fatal error: Uncaught Error: Unsupported operand types in %s:%d
+Fatal error: Uncaught TypeError: Unsupported operand types: array + stdClass in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/add_003.phpt b/Zend/tests/add_003.phpt
index f0066ee3cd..6d27863e89 100644
--- a/Zend/tests/add_003.phpt
+++ b/Zend/tests/add_003.phpt
@@ -9,9 +9,9 @@ $o = new stdclass;
$o->prop = "value";
try {
- var_dump($o + $a);
+ var_dump($o + $a);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$c = $o + $a;
@@ -20,13 +20,9 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Notice: Object of class stdClass could not be converted to number in %sadd_003.php on line %d
+Exception: Unsupported operand types: stdClass + array
-Exception: Unsupported operand types
-
-Notice: Object of class stdClass could not be converted to number in %s on line %d
-
-Fatal error: Uncaught Error: Unsupported operand types in %s:%d
+Fatal error: Uncaught TypeError: Unsupported operand types: stdClass + array in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/add_004.phpt b/Zend/tests/add_004.phpt
index a46f70b818..2f16f10eaf 100644
--- a/Zend/tests/add_004.phpt
+++ b/Zend/tests/add_004.phpt
@@ -6,9 +6,9 @@ adding numbers to arrays
$a = array(1,2,3);
try {
- var_dump($a + 5);
+ var_dump($a + 5);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$c = $a + 5;
@@ -17,9 +17,9 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types
+Exception: Unsupported operand types: array + int
-Fatal error: Uncaught Error: Unsupported operand types in %s:%d
+Fatal error: Uncaught TypeError: Unsupported operand types: array + int in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/add_005.phpt b/Zend/tests/add_005.phpt
index f5c20124cc..6981d7656f 100644
--- a/Zend/tests/add_005.phpt
+++ b/Zend/tests/add_005.phpt
@@ -17,6 +17,6 @@ var_dump($c);
echo "Done\n";
?>
--EXPECT--
-float(2834756759.1231)
-float(2834756759.1231)
+float(2834756759.123123)
+float(2834756759.123123)
Done
diff --git a/Zend/tests/add_006.phpt b/Zend/tests/add_006.phpt
index 2e7f76b4ee..09945f3fce 100644
--- a/Zend/tests/add_006.phpt
+++ b/Zend/tests/add_006.phpt
@@ -11,9 +11,12 @@ $s2 = "876222numeric";
$s3 = "48474874";
$s4 = "25.68";
-$c = $i + $s1;
-var_dump($c);
-
+try {
+ $c = $i + $s1;
+ var_dump($c);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$c = $i + $s2;
var_dump($c);
@@ -23,8 +26,12 @@ var_dump($c);
$c = $i + $s4;
var_dump($c);
-$c = $s1 + $i;
-var_dump($c);
+try {
+ $c = $s1 + $i;
+ var_dump($c);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$c = $s2 + $i;
var_dump($c);
@@ -38,18 +45,15 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Warning: A non-numeric value encountered in %s on line %d
-int(75636)
+Unsupported operand types: int + string
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(951858)
int(48550510)
float(75661.68)
+Unsupported operand types: string + int
Warning: A non-numeric value encountered in %s on line %d
-int(75636)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(951858)
int(48550510)
float(75661.68)
diff --git a/Zend/tests/add_007.phpt b/Zend/tests/add_007.phpt
index 3b24a1c99c..a2beddfaed 100644
--- a/Zend/tests/add_007.phpt
+++ b/Zend/tests/add_007.phpt
@@ -8,9 +8,9 @@ $a = array(1,2,3);
$s1 = "some string";
try {
- var_dump($a + $s1);
+ var_dump($a + $s1);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$c = $a + $s1;
@@ -19,13 +19,9 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Warning: A non-numeric value encountered in %s on line %d
+Exception: Unsupported operand types: array + string
-Exception: Unsupported operand types
-
-Warning: A non-numeric value encountered in %s on line %d
-
-Fatal error: Uncaught Error: Unsupported operand types in %s:%d
+Fatal error: Uncaught TypeError: Unsupported operand types: array + string in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/alternative_offset_syntax_compile_error_in_const_expr.phpt b/Zend/tests/alternative_offset_syntax_compile_error_in_const_expr.phpt
new file mode 100644
index 0000000000..7001d924e8
--- /dev/null
+++ b/Zend/tests/alternative_offset_syntax_compile_error_in_const_expr.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Alternative offset syntax should emit E_COMPILE_ERROR in const expression
+--FILE--
+<?php
+const FOO_COMPILE_ERROR = "BAR"{0};
+var_dump(FOO_COMPILE_ERROR);
+?>
+--EXPECTF--
+Fatal error: Array and string offset access syntax with curly braces is no longer supported in %s on line 2
diff --git a/Zend/tests/alternative_offset_syntax_compile_error_outside_const_expr.phpt b/Zend/tests/alternative_offset_syntax_compile_error_outside_const_expr.phpt
new file mode 100644
index 0000000000..c5e5848b6c
--- /dev/null
+++ b/Zend/tests/alternative_offset_syntax_compile_error_outside_const_expr.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Alternative offset syntax should emit E_COMPILE_ERROR outside const expression
+--FILE--
+<?php
+$foo = 'BAR';
+var_dump($foo{0});
+?>
+--EXPECTF--
+Fatal error: Array and string offset access syntax with curly braces is no longer supported in %s on line 3
diff --git a/Zend/tests/anon/001.phpt b/Zend/tests/anon/001.phpt
index 65ba15148b..8d7cff9fef 100644
--- a/Zend/tests/anon/001.phpt
+++ b/Zend/tests/anon/001.phpt
@@ -3,6 +3,7 @@ declare bare anonymous class
--FILE--
<?php
var_dump(new class{});
+?>
--EXPECTF--
object(class@%s)#%d (0) {
}
diff --git a/Zend/tests/anon/002.phpt b/Zend/tests/anon/002.phpt
index 80a91eed78..e29f7da27b 100644
--- a/Zend/tests/anon/002.phpt
+++ b/Zend/tests/anon/002.phpt
@@ -15,6 +15,7 @@ $a = new class extends A implements B {
};
var_dump($a instanceof A, $a instanceof B);
+?>
--EXPECT--
bool(true)
bool(true)
diff --git a/Zend/tests/anon/003.phpt b/Zend/tests/anon/003.phpt
index 7c95e86632..e4c3f7cc03 100644
--- a/Zend/tests/anon/003.phpt
+++ b/Zend/tests/anon/003.phpt
@@ -10,6 +10,7 @@ while (@$i++<10) {
}
});
}
+?>
--EXPECTF--
object(class@%s)#1 (1) {
["i"]=>
diff --git a/Zend/tests/anon/004.phpt b/Zend/tests/anon/004.phpt
index f72e7255de..8751bceb8c 100644
--- a/Zend/tests/anon/004.phpt
+++ b/Zend/tests/anon/004.phpt
@@ -26,5 +26,6 @@ $outer = new Outer(array(
/* not null because inheritance */
var_dump($outer->getArrayAccess()[0]);
+?>
--EXPECTF--
int(%d)
diff --git a/Zend/tests/anon/005.phpt b/Zend/tests/anon/005.phpt
index 7f1ff0755a..215666d23e 100644
--- a/Zend/tests/anon/005.phpt
+++ b/Zend/tests/anon/005.phpt
@@ -32,5 +32,6 @@ $proxy = $outer->getArrayAccess();
/* null because no inheritance, so no access to protected member */
var_dump(@$outer->getArrayAccess()[0]);
+?>
--EXPECT--
NULL
diff --git a/Zend/tests/anon/006.phpt b/Zend/tests/anon/006.phpt
index 0be1c33317..6bcd252dfc 100644
--- a/Zend/tests/anon/006.phpt
+++ b/Zend/tests/anon/006.phpt
@@ -9,6 +9,7 @@ namespace lone {
namespace {
var_dump ($hello);
}
+?>
--EXPECTF--
object(class@%s)#1 (0) {
}
diff --git a/Zend/tests/anon/007.phpt b/Zend/tests/anon/007.phpt
index dbc86c593e..166444b64f 100644
--- a/Zend/tests/anon/007.phpt
+++ b/Zend/tests/anon/007.phpt
@@ -17,6 +17,7 @@ namespace lone {
new Outer();
}
+?>
--EXPECTF--
object(class@%s)#2 (0) {
}
diff --git a/Zend/tests/anon/008.phpt b/Zend/tests/anon/008.phpt
index 315163ca5f..94620f6569 100644
--- a/Zend/tests/anon/008.phpt
+++ b/Zend/tests/anon/008.phpt
@@ -18,6 +18,7 @@ $anonClass = new class("cats", "dogs") {
var_dump($anonClass::$foo);
var_dump($anonClass::getBar());
+?>
--EXPECT--
string(4) "cats"
string(4) "dogs"
diff --git a/Zend/tests/anon/009.phpt b/Zend/tests/anon/009.phpt
index 4a67cdd30d..b7bf254058 100644
--- a/Zend/tests/anon/009.phpt
+++ b/Zend/tests/anon/009.phpt
@@ -14,5 +14,6 @@ $anonClass = new class {
};
var_dump($anonClass->someMethod());
+?>
--EXPECT--
string(3) "bar"
diff --git a/Zend/tests/anon/011.phpt b/Zend/tests/anon/011.phpt
index 0d16c874e8..1435d5353e 100644
--- a/Zend/tests/anon/011.phpt
+++ b/Zend/tests/anon/011.phpt
@@ -5,9 +5,9 @@ Ensure proper inheritance with get_class(anon class instance) used via class_ali
class_alias(get_class(new class { protected $foo = 1; }), "AnonBase");
var_dump((new class extends AnonBase {
- function getFoo() {
- return $this->foo;
- }
+ function getFoo() {
+ return $this->foo;
+ }
})->getFoo());
?>
--EXPECT--
diff --git a/Zend/tests/anon_class_name.phpt b/Zend/tests/anon_class_name.phpt
new file mode 100644
index 0000000000..36f613d707
--- /dev/null
+++ b/Zend/tests/anon_class_name.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Generated names for anonymous classes
+--FILE--
+<?php
+
+namespace DeclaringNS {
+ class Test1 {}
+ interface Test2 {}
+ interface Test3 {}
+}
+
+namespace UsingNS {
+ function print_name(object $obj) {
+ echo strstr(get_class($obj), "\0", true), "\n";
+ }
+
+ print_name(new class {});
+ print_name(new class extends \DeclaringNS\Test1 {});
+ print_name(new class extends \DeclaringNS\Test1 implements \DeclaringNS\Test2 {});
+ print_name(new class implements \DeclaringNS\Test2 {});
+ print_name(new class implements \DeclaringNS\Test2, \DeclaringNS\Test3 {});
+}
+
+?>
+--EXPECT--
+class@anonymous
+DeclaringNS\Test1@anonymous
+DeclaringNS\Test1@anonymous
+DeclaringNS\Test2@anonymous
+DeclaringNS\Test2@anonymous
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/arg_unpack/non_integer_keys.phpt b/Zend/tests/arg_unpack/non_integer_keys.phpt
index 19ed61f2ee..88e1747df9 100644
--- a/Zend/tests/arg_unpack/non_integer_keys.phpt
+++ b/Zend/tests/arg_unpack/non_integer_keys.phpt
@@ -3,19 +3,19 @@ Argument unpacking does not work with non-integer keys
--FILE--
<?php
function foo(...$args) {
- var_dump($args);
+ var_dump($args);
}
function gen() {
- yield 1.23 => 123;
- yield "2.34" => 234;
+ yield 1.23 => 123;
+ yield "2.34" => 234;
}
try {
- foo(...gen());
+ foo(...gen());
} catch (Error $ex) {
- echo "Exception: " . $ex->getMessage() . "\n";
+ echo "Exception: " . $ex->getMessage() . "\n";
}
?>
--EXPECT--
-Exception: Cannot unpack Traversable with non-integer keys
+Exception: Keys must be of type int|string during argument unpacking
diff --git a/Zend/tests/arg_unpack/string_keys.phpt b/Zend/tests/arg_unpack/string_keys.phpt
index c2913db5b4..b0bf366fb3 100644
--- a/Zend/tests/arg_unpack/string_keys.phpt
+++ b/Zend/tests/arg_unpack/string_keys.phpt
@@ -8,17 +8,11 @@ set_error_handler(function($errno, $errstr) {
});
try {
- var_dump(...[1, 2, "foo" => 3, 4]);
+ var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
} catch (Error $ex) {
- var_dump($ex->getMessage());
-}
-try {
- var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
-} catch (Error $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
?>
--EXPECT--
-string(36) "Cannot unpack array with string keys"
-string(42) "Cannot unpack Traversable with string keys"
+string(68) "Cannot use positional argument after named argument during unpacking"
diff --git a/Zend/tests/arginfo_zpp_mismatch.inc b/Zend/tests/arginfo_zpp_mismatch.inc
new file mode 100644
index 0000000000..2207d76db4
--- /dev/null
+++ b/Zend/tests/arginfo_zpp_mismatch.inc
@@ -0,0 +1,39 @@
+<?php
+
+function skipFunction($function): bool {
+ if (false
+ /* expect input / hang */
+ || $function === 'readline'
+ || $function === 'readline_read_history'
+ || $function === 'readline_write_history'
+ /* intentionally violate invariants */
+ || $function === 'zend_create_unterminated_string'
+ || $function === 'zend_test_array_return'
+ || $function === 'zend_leak_bytes'
+ /* mess with output */
+ || (is_string($function) && str_starts_with($function, 'ob_'))
+ || $function === 'output_add_rewrite_var'
+ || $function === 'error_log'
+ /* may spend a lot of time waiting for connection timeouts */
+ || (is_string($function) && str_contains($function, 'connect'))
+ || (is_string($function) && str_starts_with($function, 'snmp'))
+ || (is_array($function) && get_class($function[0]) === mysqli::class
+ && in_array($function[1], ['__construct', 'connect', 'real_connect']))
+ /* misc */
+ || $function === 'mail'
+ || $function === 'mb_send_mail'
+ || $function === 'pcntl_fork'
+ || $function === 'posix_kill'
+ || $function === 'posix_setrlimit'
+ || $function === 'sapi_windows_generate_ctrl_event'
+ || $function === 'imagegrabscreen'
+ ) {
+ return true;
+ }
+ if ($function[0] instanceof SoapServer) {
+ /* TODO: Uses fatal errors */
+ return true;
+ }
+
+ return false;
+}
diff --git a/Zend/tests/arginfo_zpp_mismatch.phpt b/Zend/tests/arginfo_zpp_mismatch.phpt
new file mode 100644
index 0000000000..f5df299430
--- /dev/null
+++ b/Zend/tests/arginfo_zpp_mismatch.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Test that there is no arginfo/zpp mismatch
+--SKIPIF--
+<?php
+if (getenv('SKIP_MSAN')) die("skip msan misses interceptors for some functions");
+?>
+--FILE--
+<?php
+
+require __DIR__ . "/arginfo_zpp_mismatch.inc";
+
+function test($function) {
+ if (skipFunction($function)) {
+ return;
+ }
+
+ ob_start();
+ if (is_string($function)) {
+ echo "Testing $function\n";
+ } else {
+ echo "Testing " . get_class($function[0]) . "::$function[1]\n";
+ }
+ try {
+ @$function();
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null, null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null, null, null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null, null, null, null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null, null, null, null, null, null);
+ } catch (Throwable) {
+ }
+ ob_end_clean();
+}
+
+foreach (get_defined_functions()["internal"] as $function) {
+ test($function);
+}
+
+foreach (get_declared_classes() as $class) {
+ try {
+ $rc = new ReflectionClass($class);
+ $obj = $rc->newInstanceWithoutConstructor();
+ } catch (Throwable) {
+ continue;
+ }
+
+ foreach (get_class_methods($class) as $method) {
+ test([$obj, $method]);
+ }
+}
+
+// var_dump() and debug_zval_dump() print all arguments
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/arginfo_zpp_mismatch_strict.phpt b/Zend/tests/arginfo_zpp_mismatch_strict.phpt
new file mode 100644
index 0000000000..8e77af9fb4
--- /dev/null
+++ b/Zend/tests/arginfo_zpp_mismatch_strict.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Test that there is no arginfo/zpp mismatch in strict mode
+--SKIPIF--
+<?php
+if (getenv('SKIP_MSAN')) die("skip msan misses interceptors for some functions");
+?>
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+require __DIR__ . "/arginfo_zpp_mismatch.inc";
+
+function test($function) {
+ if (skipFunction($function)) {
+ return;
+ }
+
+ ob_start();
+ if (is_string($function)) {
+ echo "Testing $function\n";
+ } else {
+ echo "Testing " . get_class($function[0]) . "::$function[1]\n";
+ }
+ try {
+ @$function();
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null, null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null, null, null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null, null, null, null, null);
+ } catch (Throwable) {
+ }
+ try {
+ @$function(null, null, null, null, null, null, null, null);
+ } catch (Throwable) {
+ }
+ ob_end_clean();
+}
+
+foreach (get_defined_functions()["internal"] as $function) {
+ test($function);
+}
+
+foreach (get_declared_classes() as $class) {
+ try {
+ $rc = new ReflectionClass($class);
+ $obj = $rc->newInstanceWithoutConstructor();
+ } catch (Throwable) {
+ continue;
+ }
+
+ foreach (get_class_methods($class) as $method) {
+ test([$obj, $method]);
+ }
+}
+
+// var_dump() and debug_zval_dump() print all arguments
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/argument_restriction_001.phpt b/Zend/tests/argument_restriction_001.phpt
index 9c21dc2cce..2c54636a58 100644
--- a/Zend/tests/argument_restriction_001.phpt
+++ b/Zend/tests/argument_restriction_001.phpt
@@ -3,14 +3,14 @@ Bug #55719 (Argument restriction should come with a more specific error message)
--FILE--
<?php
Class Base {
- public function &test($foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") {
- }
+ public function &test($foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") {
+ }
}
class Sub extends Base {
- public function &test() {
- }
+ public function &test() {
+ }
}
?>
--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 %s on line %d
diff --git a/Zend/tests/argument_restriction_002.phpt b/Zend/tests/argument_restriction_002.phpt
index 4deb2d206b..0dd0388bd3 100644
--- a/Zend/tests/argument_restriction_002.phpt
+++ b/Zend/tests/argument_restriction_002.phpt
@@ -3,14 +3,14 @@ Bug #55719 (Argument restriction should come with a more specific error message)
--FILE--
<?php
Abstract Class Base {
- public function test($foo, array &$bar, $option = NULL, $extra = 3.141592653589793238462643383279502884197169399375105 ) {
- }
+ public function test($foo, array &$bar, $option = NULL, $extra = 3.141592653589793238462643383279502884197169399375105 ) {
+ }
}
class Sub extends Base {
- public function test($foo, array &$bar) {
- }
+ public function test($foo, array &$bar) {
+ }
}
?>
--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 %s on line %d
diff --git a/Zend/tests/argument_restriction_003.phpt b/Zend/tests/argument_restriction_003.phpt
index c24e0ba852..1a96a22a87 100644
--- a/Zend/tests/argument_restriction_003.phpt
+++ b/Zend/tests/argument_restriction_003.phpt
@@ -6,14 +6,14 @@ class Foo {
}
Abstract Class Base {
- public function test(Foo $foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") {
- }
+ public function test(Foo $foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") {
+ }
}
class Sub extends Base {
- public function test() {
- }
+ public function test() {
+ }
}
?>
--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 %s on line %d
diff --git a/Zend/tests/argument_restriction_004.phpt b/Zend/tests/argument_restriction_004.phpt
index 8313d6908c..90736e8783 100644
--- a/Zend/tests/argument_restriction_004.phpt
+++ b/Zend/tests/argument_restriction_004.phpt
@@ -6,12 +6,12 @@ class Foo {
}
Abstract Class Base {
- abstract public function test(Foo $foo, array $bar, $option = NULL, $extra = 16777215) ;
+ abstract public function test(Foo $foo, array $bar, $option = NULL, $extra = 16777215) ;
}
class Sub extends Base {
- public function test(Foo $foo, array $bar, $option = NULL, $extra = 0xffffff ) {
- }
+ public function test(Foo $foo, array $bar, $option = NULL, $extra = 0xffffff ) {
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/argument_restriction_005.phpt b/Zend/tests/argument_restriction_005.phpt
index 712ccc878a..dc15593013 100644
--- a/Zend/tests/argument_restriction_005.phpt
+++ b/Zend/tests/argument_restriction_005.phpt
@@ -3,9 +3,9 @@ Bug #55719 (Argument restriction should come with a more specific error message)
--FILE--
<?php
class Sub implements ArrayAccess {
- public function offsetSet() {
- }
+ public function offsetSet() {
+ }
}
?>
--EXPECTF--
-Fatal error: Declaration of Sub::offsetSet() must be compatible with ArrayAccess::offsetSet($offset, $value) in %sargument_restriction_005.php on line %d
+Fatal error: Declaration of Sub::offsetSet() must be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value) in %sargument_restriction_005.php on line %d
diff --git a/Zend/tests/argument_restriction_006.phpt b/Zend/tests/argument_restriction_006.phpt
index 2df0e1e90d..5d0c24889a 100644
--- a/Zend/tests/argument_restriction_006.phpt
+++ b/Zend/tests/argument_restriction_006.phpt
@@ -3,14 +3,14 @@ Bug #60174 (Notice when array in method prototype error)
--FILE--
<?php
Abstract Class Base {
- public function test($foo, $extra = array("test")) {
- }
+ public function test($foo, $extra = array("test")) {
+ }
}
class Sub extends Base {
- public function test($foo, $extra) {
- }
+ public function test($foo, $extra) {
+ }
}
?>
--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 = [...]) in %s on line %d
diff --git a/Zend/tests/array_append_COW.phpt b/Zend/tests/array_append_COW.phpt
index 0e3008589b..b9965742bc 100644
--- a/Zend/tests/array_append_COW.phpt
+++ b/Zend/tests/array_append_COW.phpt
@@ -2,12 +2,12 @@
Tests that array manipulation code is correctly dealing with copy on write and splitting on reference
--FILE--
<?php
- $a=array();
- $b=1;
- $c=&$b;
- $a[]=$b;
- $b=2;
- var_dump ($a);
+ $a=array();
+ $b=1;
+ $c=&$b;
+ $a[]=$b;
+ $b=2;
+ var_dump ($a);
?>
--EXPECT--
array(1) {
diff --git a/Zend/tests/array_hash_zero.phpt b/Zend/tests/array_hash_zero.phpt
index 337cdfd1a2..0939d5bf12 100644
--- a/Zend/tests/array_hash_zero.phpt
+++ b/Zend/tests/array_hash_zero.phpt
@@ -4,12 +4,12 @@ Accept hashes being equal to zero
<?php
$hashes = [
- "\x8e\x1a\x63\x0f\x61" => 32,
- "\xf7\x17\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x6b\x03\x6a\x13\x63\x17\x6b\x1d\x67" => 64,
+ "\x8e\x1a\x63\x0f\x61" => 32,
+ "\xf7\x17\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x6b\x03\x6a\x13\x63\x17\x6b\x1d\x67" => 64,
];
foreach ($hashes as $hash => $bits) {
- var_dump($hashes[$hash], $bits);
+ var_dump($hashes[$hash], $bits);
}
?>
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..6126db9748 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
@@ -11,11 +11,11 @@ Ensure "undefined offset" notice formats message corectly when undefined key is
echo "Done\n";
?>
--EXPECTF--
-Notice: Undefined offset: -1 in %s on line 3
+Warning: Undefined array key -1 in %s on line %d
-Notice: Undefined offset: -1 in %s on line 4
+Warning: Undefined array key -1 in %s on line %d
-Notice: Undefined offset: -1 in %s on line 5
+Warning: Undefined array key -1 in %s on line %d
-Notice: Undefined offset: -1 in %s on line 6
+Warning: Undefined array key -1 in %s on line %d
Done
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/basic.phpt b/Zend/tests/array_unpack/basic.phpt
index 3363c487ec..6d7c803dd7 100644
--- a/Zend/tests/array_unpack/basic.phpt
+++ b/Zend/tests/array_unpack/basic.phpt
@@ -5,13 +5,13 @@ Basic array unpacking
$array = [1, 2, 3];
function getArr() {
- return [4, 5];
+ return [4, 5];
}
function arrGen() {
- for($i = 11; $i < 15; $i++) {
- yield $i;
- }
+ for($i = 11; $i < 15; $i++) {
+ yield $i;
+ }
}
var_dump([...[]]);
@@ -24,6 +24,7 @@ var_dump([...new ArrayIterator(['a', 'b', 'c'])]);
var_dump([0, ...$array, ...getArr(), 6, 7, 8, 9, 10, ...arrGen()]);
var_dump([0, ...$array, ...$array, 'end']);
+?>
--EXPECT--
array(0) {
}
diff --git a/Zend/tests/array_unpack/classes.phpt b/Zend/tests/array_unpack/classes.phpt
index 573c5f1c32..fa4b0f8e53 100644
--- a/Zend/tests/array_unpack/classes.phpt
+++ b/Zend/tests/array_unpack/classes.phpt
@@ -4,24 +4,25 @@ Array unpacking with classes
<?php
class C {
- public const FOO = [0, ...self::ARR, 4];
- public const ARR = [1, 2, 3];
- public static $bar = [...self::ARR];
+ public const FOO = [0, ...self::ARR, 4];
+ public const ARR = [1, 2, 3];
+ public static $bar = [...self::ARR];
}
class D {
- public const A = [...self::B];
- public const B = [...self::A];
+ public const A = [...self::B];
+ public const B = [...self::A];
}
var_dump(C::FOO);
var_dump(C::$bar);
try {
- var_dump(D::A);
+ var_dump(D::A);
} catch (Error $ex) {
- echo "Exception: " . $ex->getMessage() . "\n";
+ echo "Exception: " . $ex->getMessage() . "\n";
}
+?>
--EXPECT--
array(5) {
[0]=>
@@ -43,4 +44,4 @@ array(3) {
[2]=>
int(3)
}
-Exception: Cannot declare self-referencing constant 'self::B'
+Exception: Cannot declare self-referencing constant self::B
diff --git a/Zend/tests/array_unpack/non_integer_keys.phpt b/Zend/tests/array_unpack/non_integer_keys.phpt
index 5c93102907..a5e407743c 100644
--- a/Zend/tests/array_unpack/non_integer_keys.phpt
+++ b/Zend/tests/array_unpack/non_integer_keys.phpt
@@ -3,15 +3,16 @@ Array unpacking does not work with non-integer keys
--FILE--
<?php
function gen() {
- yield [] => 1;
- yield 1.23 => 123;
+ yield [] => 1;
+ yield 1.23 => 123;
}
try {
- [...gen()];
+ [...gen()];
} catch (Error $ex) {
- echo "Exception: " . $ex->getMessage() . "\n";
+ echo "Exception: " . $ex->getMessage() . "\n";
}
+?>
--EXPECT--
Exception: Cannot unpack Traversable with non-integer keys
diff --git a/Zend/tests/array_unpack/ref1.phpt b/Zend/tests/array_unpack/ref1.phpt
index a43e2fa09f..2f0966ae2d 100644
--- a/Zend/tests/array_unpack/ref1.phpt
+++ b/Zend/tests/array_unpack/ref1.phpt
@@ -10,6 +10,7 @@ unset($a); //array (0 => (refcount=1, is_ref=1)=1)
var_dump([...$b]); //array (0 => (refcount=0, is_ref=0)=1)
+?>
--EXPECT--
array(1) {
[0]=>
diff --git a/Zend/tests/array_unpack/string_keys.phpt b/Zend/tests/array_unpack/string_keys.phpt
index 6032d7cc3f..e4cfd77f58 100644
--- a/Zend/tests/array_unpack/string_keys.phpt
+++ b/Zend/tests/array_unpack/string_keys.phpt
@@ -4,18 +4,19 @@ array unpacking with string keys (not supported)
<?php
try {
- $array = [1, 2, "foo" => 3, 4];
- var_dump([...$array]);
+ $array = [1, 2, "foo" => 3, 4];
+ var_dump([...$array]);
} catch (Error $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
try {
- $iterator = new ArrayIterator([1, 2, "foo" => 3, 4]);
- var_dump([...$iterator]);
+ $iterator = new ArrayIterator([1, 2, "foo" => 3, 4]);
+ var_dump([...$iterator]);
} catch (Error $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
+?>
--EXPECT--
string(36) "Cannot unpack array with string keys"
string(42) "Cannot unpack Traversable with string keys"
diff --git a/Zend/tests/array_unpack/undef_var.phpt b/Zend/tests/array_unpack/undef_var.phpt
index fff1f6171e..32b8989a26 100644
--- a/Zend/tests/array_unpack/undef_var.phpt
+++ b/Zend/tests/array_unpack/undef_var.phpt
@@ -5,10 +5,11 @@ 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/array_unshift_COW.phpt b/Zend/tests/array_unshift_COW.phpt
index ecc42bb0f4..a3110693ab 100644
--- a/Zend/tests/array_unshift_COW.phpt
+++ b/Zend/tests/array_unshift_COW.phpt
@@ -2,12 +2,12 @@
Tests that array unshift code is correctly dealing with copy on write and splitting on reference
--FILE--
<?php
- $a=array();
- $b=1;
- $c=&$b;
- array_unshift ($a,$b);
- $b=2;
- var_dump ($a);
+ $a=array();
+ $b=1;
+ $c=&$b;
+ array_unshift ($a,$b);
+ $b=2;
+ var_dump ($a);
?>
--EXPECT--
array(1) {
diff --git a/Zend/tests/arrow_functions/002.phpt b/Zend/tests/arrow_functions/002.phpt
index 52c8020c19..b805b57c60 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..ae72efedc6 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/arrow_functions/006.phpt b/Zend/tests/arrow_functions/006.phpt
index 16427146a8..8079c9c491 100644
--- a/Zend/tests/arrow_functions/006.phpt
+++ b/Zend/tests/arrow_functions/006.phpt
@@ -32,7 +32,7 @@ try {
--EXPECTF--
int(2)
int(10)
-Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+{closure}(): Argument #1 ($x) must be of type int, string given, called in %s on line %d
array(3) {
[0]=>
int(20)
@@ -41,4 +41,4 @@ array(3) {
[2]=>
int(30)
}
-Argument 2 passed to {closure}() must be of the type int or null, string given, called in %s on line %d
+{closure}(): Argument #2 must be of type ?int, string given, called in %s on line %d
diff --git a/Zend/tests/arrow_functions/007.phpt b/Zend/tests/arrow_functions/007.phpt
index 0fcc4930d1..92b525ffbb 100644
--- a/Zend/tests/arrow_functions/007.phpt
+++ b/Zend/tests/arrow_functions/007.phpt
@@ -1,5 +1,8 @@
--TEST--
Pretty printing for arrow functions
+--INI--
+zend.assertions=1
+assert.exception=0
--FILE--
<?php
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/expect_015.phpt b/Zend/tests/assert/expect_015.phpt
index 7f8b0a0935..ed1b442d6e 100644
--- a/Zend/tests/assert/expect_015.phpt
+++ b/Zend/tests/assert/expect_015.phpt
@@ -6,137 +6,140 @@ assert.exception=0
--FILE--
<?php
assert(0 && ($a = function () {
- global $a, $$b;
- static $c, $d = 0;
- unset($e);
- $x = isset($a) && !empty($b) || eval($c);
- $x = $a ? $b : $c;
- $x = $a ?: $c;
- $x = $a ?? $b;
- list($a, $b, $c) = [1, 2=>'x', 'z'=>'c'];
- @foo();
- $y = clone $x;
- yield 1 => 2;
- yield from $x;
+ global $a, $$b;
+ static $c, $d = 0;
+ unset($e);
+ $x = isset($a) && !empty($b) || eval($c);
+ $x = $a ? $b : $c;
+ $x = $a ?: $c;
+ $x = $a ?? $b;
+ list($a, $b, $c) = [1, 2=>'x', 'z'=>'c'];
+ @foo();
+ $y = clone $x;
+ yield 1 => 2;
+ yield from $x;
}));
assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X {
- abstract class A extends B implements C, D {
- const X = 12;
- const Y = self::X, Z = "aaa";
+ abstract class A extends B implements C, D {
+ const X = 12;
+ const Y = self::X, Z = "aaa";
- public $a = 1, $b;
- protected $c;
- static private $d = null;
+ public $a = 1, $b;
+ protected $c;
+ static private $d = null;
- abstract function foo();
+ abstract function foo();
- static private function f1() {
- for ($i = 0, $j = 100; $i < $j; $i++, --$j) {
- $s[$i] = $a[$j];
- }
- foreach ($a as $key => &$val) {
- print "$key => $val\n";
- }
- while ($s[$i]) {
- $i++;
- }
- do {
- $i--;
- } while ($s[$i]);
- $x = foo($a + 1, 4, ...[1,2,3]);
- $x = ${$a . "_1"}();
- $x = A::foo();
- $x = ${$a . "_1"}::foo();
- $x = A::${$a . "_1"}();
- $x = $x->foo();
- $x = ${$a . "_1"}->foo();
- $x = $x->{$a . "_1"}();
- $x->a = C::C;
- ${$a . "_1"}->a = ${$a . "_1"}::C;
- $x->{a . "_1"} = C::C;
- $x = C::$z;
- $x = ${$a . "_1"}::$z;
- $x = C::${$z . "_1"};
- }
- }
+ static private function f1() {
+ for ($i = 0, $j = 100; $i < $j; $i++, --$j) {
+ $s[$i] = $a[$j];
+ }
+ foreach ($a as $key => &$val) {
+ print "$key => $val\n";
+ }
+ while ($s[$i]) {
+ $i++;
+ }
+ do {
+ $i--;
+ } while ($s[$i]);
+ $x = foo($a + 1, 4, ...[1,2,3]);
+ $x = ${$a . "_1"}();
+ $x = A::foo();
+ $x = ${$a . "_1"}::foo();
+ $x = A::${$a . "_1"}();
+ $x = $x->foo();
+ $x = ${$a . "_1"}->foo();
+ $x = $x->{$a . "_1"}();
+ $x->a = C::C;
+ ${$a . "_1"}->a = ${$a . "_1"}::C;
+ $x->{a . "_1"} = C::C;
+ $x = C::$z;
+ $x = ${$a . "_1"}::$z;
+ $x = C::${$z . "_1"};
+ $x?->y;
+ $x?->y();
+ foo(bar: $x);
+ }
+ }
}));
-assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
- final class A {
- final protected function f2() {
- if (!$x) {
- return 0;
- }
- if ($x == 1) {
- return 1;
- } else if ($x == 2) {
- return 2;
- } else if ($x == 3) {
- return 3;
- } else {
- if ($x == 9) {
- return 9;
- }
+assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use ($c,&$d) : X {
+ final class A {
+ final protected function f2() {
+ if (!$x) {
+ return 0;
+ }
+ if ($x == 1) {
+ return 1;
+ } else if ($x == 2) {
+ return 2;
+ } else if ($x == 3) {
+ return 3;
+ } else {
+ if ($x == 9) {
+ return 9;
+ }
L0:
do {
- switch ($x) {
- case 4: break;
- case 5: continue;
- case 6: break 2;
- case 7: continue 2;
- case 8: goto L0;
- default: return;
- }
- } while (0);
- }
- }
- }
+ switch ($x) {
+ case 4: break;
+ case 5: continue;
+ case 6: break 2;
+ case 7: continue 2;
+ case 8: goto L0;
+ default: return;
+ }
+ } while (0);
+ }
+ }
+ }
}));
assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X {
- class A {
- use T1, T2 {
- T1::foo insteadof foo;
- T2::foo as bar;
- baz as public;
- ops as protected x;
- }
- use T3;
- }
+ class A {
+ use T1, T2 {
+ T1::foo insteadof foo;
+ T2::foo as bar;
+ baz as public;
+ ops as protected x;
+ }
+ use T3;
+ }
}));
assert(0 && ($a = function &(array &...$a) {
- declare(A=1,B=2);
- try {
- $i++;
- } catch (MyException $e) {
- echo 1;
- } catch (Exception $e) {
- echo 2;
- } finally {
- echo 3;
- }
+ declare(A=1,B=2);
+ try {
+ $i++;
+ } catch (MyException $e) {
+ echo 1;
+ } catch (Exception $e) {
+ echo 2;
+ } finally {
+ echo 3;
+ }
}));
-assert(0 && ($a = function () {
- declare(C=1) { echo 1; }
- $x = '\'"`$a';
- $x = "'\"`$a";
- $x = `'"\`$a`;
- $x = "{$a}b";
- $x = "${a}b";
- $x = " {$foo->bar} ${$foo->bar} ";
- $x = " ${'---'} ";
- foo();
- \foo();
- namespace\foo();
- $x = foo;
- $x = \foo;
- $x = namespace\foo;
- $x = new foo();
- $x = new \foo();
- $x = new namespace\foo();
+assert(0 && ($a = function (): ?static {
+ declare(C=1) { echo 1; }
+ $x = '\'"`$a';
+ $x = "'\"`$a";
+ $x = `'"\`$a`;
+ $x = "{$a}b";
+ $x = "${a}b";
+ $x = " {$foo->bar} ${$foo->bar} ";
+ $x = " ${'---'} ";
+ foo();
+ \foo();
+ namespace\foo();
+ $x = foo;
+ $x = \foo;
+ $x = namespace\foo;
+ $x = new foo();
+ $x = new \foo();
+ $x = new namespace\foo();
if ($a) {
} elseif ($b) {
}
@@ -160,12 +163,12 @@ Warning: assert(): assert(0 && ($a = function () {
$y = clone $x;
yield 1 => 2;
yield from $x;
-})) failed in %sexpect_015.php on line %d
+})) failed in %s on line %d
Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
abstract class A extends B implements C, D {
- const X = 12;
- const Y = self::X, Z = 'aaa';
+ public const X = 12;
+ public const Y = self::X, Z = 'aaa';
public $a = 1, $b;
protected $c;
private static $d = null;
@@ -198,13 +201,16 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c,
$x = C::$z;
$x = ${$a . '_1'}::$z;
$x = C::${$z . '_1'};
+ $x?->y;
+ $x?->y();
+ foo(bar: $x);
}
}
-})) failed in %sexpect_015.php on line %d
+})) failed in %s on line %d
-Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
+Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use($c, &$d): X {
final class A {
protected final function f2() {
if (!$x) {
@@ -242,7 +248,7 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c,
}
-})) failed in %sexpect_015.php on line %d
+})) failed in %s on line %d
Warning: assert(): assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X {
class A {
@@ -255,7 +261,7 @@ Warning: assert(): assert(0 && ($a = function &(?array &$a, X $b = null) use($c,
use T3;
}
-})) failed in %sexpect_015.php on line %d
+})) failed in %s on line %d
Warning: assert(): assert(0 && ($a = function &(array &...$a) {
declare(A = 1, B = 2);
@@ -268,9 +274,9 @@ Warning: assert(): assert(0 && ($a = function &(array &...$a) {
} finally {
echo 3;
}
-})) failed in %sexpect_015.php on line %d
+})) failed in %s on line %d
-Warning: assert(): assert(0 && ($a = function () {
+Warning: assert(): assert(0 && ($a = function (): ?static {
declare(C = 1) {
echo 1;
}
@@ -296,4 +302,4 @@ Warning: assert(): assert(0 && ($a = function () {
if ($a) {
} else {
}
-})) failed in %sexpect_015.php on line %d
+})) failed in %s on line %d
diff --git a/Zend/tests/assert/expect_020.phpt b/Zend/tests/assert/expect_020.phpt
index ef8fd5ec12..91b303a42f 100644
--- a/Zend/tests/assert/expect_020.phpt
+++ b/Zend/tests/assert/expect_020.phpt
@@ -6,8 +6,8 @@ assert.exception=0
--FILE--
<?php
assert(0 && ($a = function () {
- $var = 'test';
- $str = "$var, $var[1], {$var}[], {$var[1]}[], ${var}[], ${var[1]}[]";
+ $var = 'test';
+ $str = "$var, $var[1], {$var}[], {$var[1]}[], ${var}[], ${var[1]}[]";
}));
?>
--EXPECTF--
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_concat_array_empty_string.phpt b/Zend/tests/assign_concat_array_empty_string.phpt
index fcacb60675..6e551d9039 100644
--- a/Zend/tests/assign_concat_array_empty_string.phpt
+++ b/Zend/tests/assign_concat_array_empty_string.phpt
@@ -9,5 +9,5 @@ var_dump($a);
?>
--EXPECTF--
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
diff --git a/Zend/tests/assign_dim_obj_null_return.phpt b/Zend/tests/assign_dim_obj_null_return.phpt
index cff877fd8f..b046a86513 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" on bool
+Attempt to assign property "foo" on bool
diff --git a/Zend/tests/assign_obj_ref_return.phpt b/Zend/tests/assign_obj_ref_return.phpt
new file mode 100644
index 0000000000..0c21c08ec0
--- /dev/null
+++ b/Zend/tests/assign_obj_ref_return.phpt
@@ -0,0 +1,18 @@
+--TEST--
+ASSIGN_OBJ should not return reference
+--FILE--
+<?php
+
+$obj = new stdClass;
+$obj->ref =& $ref;
+$obj->val = $obj->ref = 42;
+var_dump($obj);
+
+?>
+--EXPECT--
+object(stdClass)#1 (2) {
+ ["ref"]=>
+ &int(42)
+ ["val"]=>
+ int(42)
+}
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_obj_002.phpt b/Zend/tests/assign_to_obj_002.phpt
index 0ab2e84163..a911c06f36 100644
--- a/Zend/tests/assign_to_obj_002.phpt
+++ b/Zend/tests/assign_to_obj_002.phpt
@@ -4,7 +4,7 @@ Assign to $this leaks when $this not defined
<?php
try {
- $this->a = new stdClass;
+ $this->a = new stdClass;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
?>
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/ast/zend-pow-assign.phpt b/Zend/tests/ast/zend-pow-assign.phpt
index d978e77ce6..c471c34960 100644
--- a/Zend/tests/ast/zend-pow-assign.phpt
+++ b/Zend/tests/ast/zend-pow-assign.phpt
@@ -2,10 +2,12 @@
ZEND_POW_ASSIGN
--INI--
zend.assertions=1
+assert.exception=0
--FILE--
<?php
assert_options(ASSERT_WARNING);
assert(false && ($a **= 2));
+?>
--EXPECTF--
Warning: assert(): assert(false && ($a **= 2)) failed in %s%ezend-pow-assign.php on line %d
diff --git a/Zend/tests/ast_serialize_backtick_literal.phpt b/Zend/tests/ast_serialize_backtick_literal.phpt
index 4dd65963c5..0465abac33 100644
--- a/Zend/tests/ast_serialize_backtick_literal.phpt
+++ b/Zend/tests/ast_serialize_backtick_literal.phpt
@@ -2,10 +2,12 @@
Serialization of backtick literal is incorrect
--INI--
zend.assertions=1
+assert.exception=0
--FILE--
<?php
assert_options(ASSERT_WARNING);
assert(false && `echo -n ""`);
+?>
--EXPECTF--
Warning: assert(): assert(false && `echo -n ""`) failed in %s%east_serialize_backtick_literal.php on line %d
diff --git a/Zend/tests/attributes/001_placement.phpt b/Zend/tests/attributes/001_placement.phpt
new file mode 100644
index 0000000000..518c890ef2
--- /dev/null
+++ b/Zend/tests/attributes/001_placement.phpt
@@ -0,0 +1,134 @@
+--TEST--
+Attributes can be placed on all supported elements.
+--FILE--
+<?php
+
+#[A1(1)]
+class Foo
+{
+ #[A1(2)]
+ public const FOO = 'foo';
+
+ #[A1(3)]
+ public $x;
+
+ #[A1(4)]
+ public function foo(#[A1(5)] $a, #[A1(6)] $b) { }
+}
+
+$object = new #[A1(7)] class () { };
+
+#[A1(8)]
+function f1() { }
+
+$f2 = #[A1(9)] function () { };
+
+$f3 = #[A1(10)] fn () => 1;
+
+$ref = new \ReflectionClass(Foo::class);
+
+$sources = [
+ $ref,
+ $ref->getReflectionConstant('FOO'),
+ $ref->getProperty('x'),
+ $ref->getMethod('foo'),
+ $ref->getMethod('foo')->getParameters()[0],
+ $ref->getMethod('foo')->getParameters()[1],
+ new \ReflectionObject($object),
+ new \ReflectionFunction('f1'),
+ new \ReflectionFunction($f2),
+ new \ReflectionFunction($f3)
+];
+
+foreach ($sources as $r) {
+ $attr = $r->getAttributes();
+ var_dump(get_class($r), count($attr));
+
+ foreach ($attr as $a) {
+ var_dump($a->getName(), $a->getArguments());
+ }
+
+ echo "\n";
+}
+
+?>
+--EXPECT--
+string(15) "ReflectionClass"
+int(1)
+string(2) "A1"
+array(1) {
+ [0]=>
+ int(1)
+}
+
+string(23) "ReflectionClassConstant"
+int(1)
+string(2) "A1"
+array(1) {
+ [0]=>
+ int(2)
+}
+
+string(18) "ReflectionProperty"
+int(1)
+string(2) "A1"
+array(1) {
+ [0]=>
+ int(3)
+}
+
+string(16) "ReflectionMethod"
+int(1)
+string(2) "A1"
+array(1) {
+ [0]=>
+ int(4)
+}
+
+string(19) "ReflectionParameter"
+int(1)
+string(2) "A1"
+array(1) {
+ [0]=>
+ int(5)
+}
+
+string(19) "ReflectionParameter"
+int(1)
+string(2) "A1"
+array(1) {
+ [0]=>
+ int(6)
+}
+
+string(16) "ReflectionObject"
+int(1)
+string(2) "A1"
+array(1) {
+ [0]=>
+ int(7)
+}
+
+string(18) "ReflectionFunction"
+int(1)
+string(2) "A1"
+array(1) {
+ [0]=>
+ int(8)
+}
+
+string(18) "ReflectionFunction"
+int(1)
+string(2) "A1"
+array(1) {
+ [0]=>
+ int(9)
+}
+
+string(18) "ReflectionFunction"
+int(1)
+string(2) "A1"
+array(1) {
+ [0]=>
+ int(10)
+}
diff --git a/Zend/tests/attributes/002_rfcexample.phpt b/Zend/tests/attributes/002_rfcexample.phpt
new file mode 100644
index 0000000000..8a0abf7878
--- /dev/null
+++ b/Zend/tests/attributes/002_rfcexample.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Attributes: Example from Attributes RFC
+--FILE--
+<?php
+// https://wiki.php.net/rfc/attributes_v2#attribute_syntax
+namespace My\Attributes {
+ use Attribute;
+
+ #[Attribute]
+ class SingleArgument {
+ public $argumentValue;
+
+ public function __construct($argumentValue) {
+ $this->argumentValue = $argumentValue;
+ }
+ }
+}
+
+namespace {
+ use My\Attributes\SingleArgument;
+
+ #[SingleArgument("Hello World")]
+ class Foo {
+ }
+
+ $reflectionClass = new \ReflectionClass(Foo::class);
+ $attributes = $reflectionClass->getAttributes();
+
+ var_dump($attributes[0]->getName());
+ var_dump($attributes[0]->getArguments());
+ var_dump($attributes[0]->newInstance());
+}
+?>
+--EXPECTF--
+string(28) "My\Attributes\SingleArgument"
+array(1) {
+ [0]=>
+ string(11) "Hello World"
+}
+object(My\Attributes\SingleArgument)#%d (1) {
+ ["argumentValue"]=>
+ string(11) "Hello World"
+}
diff --git a/Zend/tests/attributes/003_ast_nodes.phpt b/Zend/tests/attributes/003_ast_nodes.phpt
new file mode 100644
index 0000000000..854edf3d63
--- /dev/null
+++ b/Zend/tests/attributes/003_ast_nodes.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Attributes can deal with AST nodes.
+--FILE--
+<?php
+
+define('V1', strtoupper(php_sapi_name()));
+
+#[A1([V1 => V1])]
+class C1
+{
+ public const BAR = 'bar';
+}
+
+$ref = new \ReflectionClass(C1::class);
+$attr = $ref->getAttributes();
+var_dump(count($attr));
+
+$args = $attr[0]->getArguments();
+var_dump(count($args), $args[0][V1] === V1);
+
+echo "\n";
+
+#[A1(V1, 1 + 2, C1::class)]
+class C2 { }
+
+$ref = new \ReflectionClass(C2::class);
+$attr = $ref->getAttributes();
+var_dump(count($attr));
+
+$args = $attr[0]->getArguments();
+var_dump(count($args));
+var_dump($args[0] === V1);
+var_dump($args[1] === 3);
+var_dump($args[2] === C1::class);
+
+echo "\n";
+
+#[A1(self::FOO, C1::BAR)]
+class C3
+{
+ private const FOO = 'foo';
+}
+
+$ref = new \ReflectionClass(C3::class);
+$attr = $ref->getAttributes();
+var_dump(count($attr));
+
+$args = $attr[0]->getArguments();
+var_dump(count($args));
+var_dump($args[0] === 'foo');
+var_dump($args[1] === C1::BAR);
+
+echo "\n";
+
+#[ExampleWithShift(4 >> 1)]
+class C4 {}
+$ref = new \ReflectionClass(C4::class);
+var_dump($ref->getAttributes()[0]->getArguments());
+
+echo "\n";
+
+#[Attribute]
+class C5
+{
+ public function __construct() { }
+}
+
+$ref = new \ReflectionFunction(#[C5(MissingClass::SOME_CONST)] function () { });
+$attr = $ref->getAttributes();
+var_dump(count($attr));
+
+try {
+ $attr[0]->getArguments();
+} catch (\Error $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $attr[0]->newInstance();
+} catch (\Error $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECT--
+int(1)
+int(1)
+bool(true)
+
+int(1)
+int(3)
+bool(true)
+bool(true)
+bool(true)
+
+int(1)
+int(2)
+bool(true)
+bool(true)
+
+array(1) {
+ [0]=>
+ int(2)
+}
+
+int(1)
+string(30) "Class "MissingClass" not found"
+string(30) "Class "MissingClass" not found"
diff --git a/Zend/tests/attributes/004_name_resolution.phpt b/Zend/tests/attributes/004_name_resolution.phpt
new file mode 100644
index 0000000000..aececca0d4
--- /dev/null
+++ b/Zend/tests/attributes/004_name_resolution.phpt
@@ -0,0 +1,96 @@
+--TEST--
+Resolve attribute names
+--FILE--
+<?php
+
+namespace {
+ function dump_attributes($attributes) {
+ $arr = [];
+ foreach ($attributes as $attribute) {
+ $arr[] = ['name' => $attribute->getName(), 'args' => $attribute->getArguments()];
+ }
+ var_dump($arr);
+ }
+}
+
+namespace Doctrine\ORM\Mapping {
+ class Entity {
+ }
+}
+
+namespace Doctrine\ORM\Attributes {
+ class Table {
+ }
+}
+
+namespace Foo {
+ use Doctrine\ORM\Mapping\Entity;
+ use Doctrine\ORM\Mapping as ORM;
+ use Doctrine\ORM\Attributes;
+
+ #[Entity("imported class")]
+ #[ORM\Entity("imported namespace")]
+ #[\Doctrine\ORM\Mapping\Entity("absolute from namespace")]
+ #[\Entity("import absolute from global")]
+ #[Attributes\Table()]
+ function foo() {
+ }
+}
+
+namespace {
+ class Entity {}
+
+ dump_attributes((new ReflectionFunction('Foo\foo'))->getAttributes());
+}
+?>
+--EXPECT--
+array(5) {
+ [0]=>
+ array(2) {
+ ["name"]=>
+ string(27) "Doctrine\ORM\Mapping\Entity"
+ ["args"]=>
+ array(1) {
+ [0]=>
+ string(14) "imported class"
+ }
+ }
+ [1]=>
+ array(2) {
+ ["name"]=>
+ string(27) "Doctrine\ORM\Mapping\Entity"
+ ["args"]=>
+ array(1) {
+ [0]=>
+ string(18) "imported namespace"
+ }
+ }
+ [2]=>
+ array(2) {
+ ["name"]=>
+ string(27) "Doctrine\ORM\Mapping\Entity"
+ ["args"]=>
+ array(1) {
+ [0]=>
+ string(23) "absolute from namespace"
+ }
+ }
+ [3]=>
+ array(2) {
+ ["name"]=>
+ string(6) "Entity"
+ ["args"]=>
+ array(1) {
+ [0]=>
+ string(27) "import absolute from global"
+ }
+ }
+ [4]=>
+ array(2) {
+ ["name"]=>
+ string(29) "Doctrine\ORM\Attributes\Table"
+ ["args"]=>
+ array(0) {
+ }
+ }
+}
diff --git a/Zend/tests/attributes/005_objects.phpt b/Zend/tests/attributes/005_objects.phpt
new file mode 100644
index 0000000000..db0107500c
--- /dev/null
+++ b/Zend/tests/attributes/005_objects.phpt
@@ -0,0 +1,120 @@
+--TEST--
+Attributes can be converted into objects.
+--FILE--
+<?php
+
+#[Attribute(Attribute::TARGET_FUNCTION)]
+class A1
+{
+ public string $name;
+ public int $ttl;
+
+ public function __construct(string $name, int $ttl = 50)
+ {
+ $this->name = $name;
+ $this->ttl = $ttl;
+ }
+}
+
+$ref = new \ReflectionFunction(#[A1('test')] function () { });
+
+foreach ($ref->getAttributes() as $attr) {
+ $obj = $attr->newInstance();
+
+ var_dump(get_class($obj), $obj->name, $obj->ttl);
+}
+
+echo "\n";
+
+$ref = new \ReflectionFunction(#[A1] function () { });
+
+try {
+ $ref->getAttributes()[0]->newInstance();
+} catch (\ArgumentCountError $e) {
+ var_dump('ERROR 1', $e->getMessage());
+}
+
+echo "\n";
+
+$ref = new \ReflectionFunction(#[A1([])] function () { });
+
+try {
+ $ref->getAttributes()[0]->newInstance();
+} catch (\TypeError $e) {
+ var_dump('ERROR 2', $e->getMessage());
+}
+
+echo "\n";
+
+$ref = new \ReflectionFunction(#[A2] function () { });
+
+try {
+ $ref->getAttributes()[0]->newInstance();
+} catch (\Error $e) {
+ var_dump('ERROR 3', $e->getMessage());
+}
+
+echo "\n";
+
+#[Attribute]
+class A3
+{
+ private function __construct() { }
+}
+
+$ref = new \ReflectionFunction(#[A3] function () { });
+
+try {
+ $ref->getAttributes()[0]->newInstance();
+} catch (\Error $e) {
+ var_dump('ERROR 4', $e->getMessage());
+}
+
+echo "\n";
+
+#[Attribute]
+class A4 { }
+
+$ref = new \ReflectionFunction(#[A4(1)] function () { });
+
+try {
+ $ref->getAttributes()[0]->newInstance();
+} catch (\Error $e) {
+ var_dump('ERROR 5', $e->getMessage());
+}
+
+echo "\n";
+
+class A5 { }
+
+$ref = new \ReflectionFunction(#[A5] function () { });
+
+try {
+ $ref->getAttributes()[0]->newInstance();
+} catch (\Error $e) {
+ var_dump('ERROR 6', $e->getMessage());
+}
+
+?>
+--EXPECTF--
+string(2) "A1"
+string(4) "test"
+int(50)
+
+string(7) "ERROR 1"
+string(%d) "Too few arguments to function A1::__construct(), 0 passed in %s005_objects.php on line 26 and at least 1 expected"
+
+string(7) "ERROR 2"
+string(%d) "A1::__construct(): Argument #1 ($name) must be of type string, array given, called in %s005_objects.php on line 36"
+
+string(7) "ERROR 3"
+string(30) "Attribute class "A2" not found"
+
+string(7) "ERROR 4"
+string(48) "Attribute constructor of class A3 must be public"
+
+string(7) "ERROR 5"
+string(69) "Attribute class A4 does not have a constructor, cannot pass arguments"
+
+string(7) "ERROR 6"
+string(55) "Attempting to use non-attribute class "A5" as attribute"
diff --git a/Zend/tests/attributes/006_filter.phpt b/Zend/tests/attributes/006_filter.phpt
new file mode 100644
index 0000000000..2924e6ed79
--- /dev/null
+++ b/Zend/tests/attributes/006_filter.phpt
@@ -0,0 +1,112 @@
+--TEST--
+Attributes can be filtered by name and base type.
+--FILE--
+<?php
+
+$ref = new \ReflectionFunction(#[A1] #[A2] function () { });
+$attr = $ref->getAttributes(A3::class);
+
+var_dump(count($attr));
+
+$ref = new \ReflectionFunction(#[A1] #[A2] function () { });
+$attr = $ref->getAttributes(A2::class);
+
+var_dump(count($attr), $attr[0]->getName());
+
+$ref = new \ReflectionFunction(#[A1] #[A2] #[A2] function () { });
+$attr = $ref->getAttributes(A2::class);
+
+var_dump(count($attr), $attr[0]->getName(), $attr[1]->getName());
+
+echo "\n";
+
+interface Base { }
+class A1 implements Base { }
+class A2 implements Base { }
+class A3 extends A2 { }
+
+$ref = new \ReflectionFunction(#[A1] #[A2] #[A5] function () { });
+$attr = $ref->getAttributes(\stdClass::class, \ReflectionAttribute::IS_INSTANCEOF);
+var_dump(count($attr));
+print_r(array_map(fn ($a) => $a->getName(), $attr));
+
+$ref = new \ReflectionFunction(#[A1] #[A2] function () { });
+$attr = $ref->getAttributes(A1::class, \ReflectionAttribute::IS_INSTANCEOF);
+var_dump(count($attr));
+print_r(array_map(fn ($a) => $a->getName(), $attr));
+
+$ref = new \ReflectionFunction(#[A1] #[A2] function () { });
+$attr = $ref->getAttributes(Base::class, \ReflectionAttribute::IS_INSTANCEOF);
+var_dump(count($attr));
+print_r(array_map(fn ($a) => $a->getName(), $attr));
+
+$ref = new \ReflectionFunction(#[A1] #[A2] #[A3] function () { });
+$attr = $ref->getAttributes(A2::class, \ReflectionAttribute::IS_INSTANCEOF);
+var_dump(count($attr));
+print_r(array_map(fn ($a) => $a->getName(), $attr));
+
+$ref = new \ReflectionFunction(#[A1] #[A2] #[A3] function () { });
+$attr = $ref->getAttributes(Base::class, \ReflectionAttribute::IS_INSTANCEOF);
+var_dump(count($attr));
+print_r(array_map(fn ($a) => $a->getName(), $attr));
+
+echo "\n";
+
+$ref = new \ReflectionFunction(function () { });
+
+try {
+ $ref->getAttributes(A1::class, 3);
+} catch (\Error $e) {
+ var_dump('ERROR 1', $e->getMessage());
+}
+
+$ref = new \ReflectionFunction(function () { });
+
+try {
+ $ref->getAttributes(SomeMissingClass::class, \ReflectionAttribute::IS_INSTANCEOF);
+} catch (\Error $e) {
+ var_dump('ERROR 2', $e->getMessage());
+}
+
+?>
+--EXPECT--
+int(0)
+int(1)
+string(2) "A2"
+int(2)
+string(2) "A2"
+string(2) "A2"
+
+int(0)
+Array
+(
+)
+int(1)
+Array
+(
+ [0] => A1
+)
+int(2)
+Array
+(
+ [0] => A1
+ [1] => A2
+)
+int(2)
+Array
+(
+ [0] => A2
+ [1] => A3
+)
+int(3)
+Array
+(
+ [0] => A1
+ [1] => A2
+ [2] => A3
+)
+
+string(7) "ERROR 1"
+string(103) "ReflectionFunctionAbstract::getAttributes(): Argument #2 ($flags) must be a valid attribute filter flag"
+string(7) "ERROR 2"
+string(34) "Class "SomeMissingClass" not found"
diff --git a/Zend/tests/attributes/007_self_reflect_attribute.phpt b/Zend/tests/attributes/007_self_reflect_attribute.phpt
new file mode 100644
index 0000000000..b95542f87e
--- /dev/null
+++ b/Zend/tests/attributes/007_self_reflect_attribute.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Attributes: attributes on Attribute return itself
+--FILE--
+<?php
+
+$reflection = new \ReflectionClass(Attribute::class);
+$attributes = $reflection->getAttributes();
+
+foreach ($attributes as $attribute) {
+ var_dump($attribute->getName());
+ var_dump($attribute->getArguments());
+
+ $a = $attribute->newInstance();
+ var_dump(get_class($a));
+ var_dump($a->flags == Attribute::TARGET_ALL);
+}
+?>
+--EXPECT--
+string(9) "Attribute"
+array(0) {
+}
+string(9) "Attribute"
+bool(true)
diff --git a/Zend/tests/attributes/008_wrong_attribution.phpt b/Zend/tests/attributes/008_wrong_attribution.phpt
new file mode 100644
index 0000000000..af61bcf105
--- /dev/null
+++ b/Zend/tests/attributes/008_wrong_attribution.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Attributes: Prevent Attribute on non classes
+--FILE--
+<?php
+
+#[Attribute]
+function foo() {}
+?>
+--EXPECTF--
+Fatal error: Attribute "Attribute" cannot target function (allowed targets: class) in %s
diff --git a/Zend/tests/attributes/009_doctrine_annotations_example.phpt b/Zend/tests/attributes/009_doctrine_annotations_example.phpt
new file mode 100644
index 0000000000..1f2aa647f0
--- /dev/null
+++ b/Zend/tests/attributes/009_doctrine_annotations_example.phpt
@@ -0,0 +1,161 @@
+--TEST--
+Doctrine-like attributes usage
+--FILE--
+<?php
+
+namespace Doctrine\ORM\Attributes {
+ class Annotation { public $values; public function construct() { $this->values = func_get_args(); } }
+ class Entity extends Annotation {}
+ class Id extends Annotation {}
+ class Column extends Annotation { const UNIQUE = 'unique'; const T_INTEGER = 'integer'; }
+ class GeneratedValue extends Annotation {}
+ class JoinTable extends Annotation {}
+ class ManyToMany extends Annotation {}
+ class JoinColumn extends Annotation { const UNIQUE = 'unique'; }
+ class InverseJoinColumn extends Annotation {}
+}
+
+namespace Symfony\Component\Validator\Constraints {
+ class Annotation { public $values; public function construct() { $this->values = func_get_args(); } }
+ class Email extends Annotation {}
+ class Range extends Annotation {}
+}
+
+namespace {
+use Doctrine\ORM\Attributes as ORM;
+use Symfony\Component\Validator\Constraints as Assert;
+
+#[ORM\Entity]
+/** @ORM\Entity */
+class User
+{
+ /** @ORM\Id @ORM\Column(type="integer"*) @ORM\GeneratedValue */
+ #[ORM\Id]
+ #[ORM\Column("integer")]
+ #[ORM\GeneratedValue]
+ private $id;
+
+ /**
+ * @ORM\Column(type="string", unique=true)
+ * @Assert\Email(message="The email '{{ value }}' is not a valid email.")
+ */
+ #[ORM\Column("string", ORM\Column::UNIQUE)]
+ #[Assert\Email(array("message" => "The email '{{ value }}' is not a valid email."))]
+ private $email;
+
+ /**
+ * @ORM\Column(type="integer")
+ * @Assert\Range(
+ * min = 120,
+ * max = 180,
+ * minMessage = "You must be at least {{ limit }}cm tall to enter",
+ * maxMessage = "You cannot be taller than {{ limit }}cm to enter"
+ * )
+ */
+ #[Assert\Range(["min" => 120, "max" => 180, "minMessage" => "You must be at least {{ limit }}cm tall to enter"])]
+ #[ORM\Column(ORM\Column::T_INTEGER)]
+ protected $height;
+
+ /**
+ * @ORM\ManyToMany(targetEntity="Phonenumber")
+ * @ORM\JoinTable(name="users_phonenumbers",
+ * joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
+ * inverseJoinColumns={@ORM\JoinColumn(name="phonenumber_id", referencedColumnName="id", unique=true)}
+ * )
+ */
+ #[ORM\ManyToMany(Phonenumber::class)]
+ #[ORM\JoinTable("users_phonenumbers")]
+ #[ORM\JoinColumn("user_id", "id")]
+ #[ORM\InverseJoinColumn("phonenumber_id", "id", ORM\JoinColumn::UNIQUE)]
+ private $phonenumbers;
+}
+
+$class = new ReflectionClass(User::class);
+$attributes = $class->getAttributes();
+
+foreach ($attributes as $attribute) {
+ var_dump($attribute->getName(), $attribute->getArguments());
+}
+
+foreach ($class->getProperties() as $property) {
+ $attributes = $property->getAttributes();
+
+ foreach ($attributes as $attribute) {
+ var_dump($attribute->getName(), $attribute->getArguments());
+ }
+}
+}
+?>
+--EXPECT--
+string(30) "Doctrine\ORM\Attributes\Entity"
+array(0) {
+}
+string(26) "Doctrine\ORM\Attributes\Id"
+array(0) {
+}
+string(30) "Doctrine\ORM\Attributes\Column"
+array(1) {
+ [0]=>
+ string(7) "integer"
+}
+string(38) "Doctrine\ORM\Attributes\GeneratedValue"
+array(0) {
+}
+string(30) "Doctrine\ORM\Attributes\Column"
+array(2) {
+ [0]=>
+ string(6) "string"
+ [1]=>
+ string(6) "unique"
+}
+string(45) "Symfony\Component\Validator\Constraints\Email"
+array(1) {
+ [0]=>
+ array(1) {
+ ["message"]=>
+ string(45) "The email '{{ value }}' is not a valid email."
+ }
+}
+string(45) "Symfony\Component\Validator\Constraints\Range"
+array(1) {
+ [0]=>
+ array(3) {
+ ["min"]=>
+ int(120)
+ ["max"]=>
+ int(180)
+ ["minMessage"]=>
+ string(48) "You must be at least {{ limit }}cm tall to enter"
+ }
+}
+string(30) "Doctrine\ORM\Attributes\Column"
+array(1) {
+ [0]=>
+ string(7) "integer"
+}
+string(34) "Doctrine\ORM\Attributes\ManyToMany"
+array(1) {
+ [0]=>
+ string(11) "Phonenumber"
+}
+string(33) "Doctrine\ORM\Attributes\JoinTable"
+array(1) {
+ [0]=>
+ string(18) "users_phonenumbers"
+}
+string(34) "Doctrine\ORM\Attributes\JoinColumn"
+array(2) {
+ [0]=>
+ string(7) "user_id"
+ [1]=>
+ string(2) "id"
+}
+string(41) "Doctrine\ORM\Attributes\InverseJoinColumn"
+array(3) {
+ [0]=>
+ string(14) "phonenumber_id"
+ [1]=>
+ string(2) "id"
+ [2]=>
+ string(6) "unique"
+}
diff --git a/Zend/tests/attributes/010_unsupported_const_expression.phpt b/Zend/tests/attributes/010_unsupported_const_expression.phpt
new file mode 100644
index 0000000000..498898379d
--- /dev/null
+++ b/Zend/tests/attributes/010_unsupported_const_expression.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Attribute arguments support only const expressions.
+--FILE--
+<?php
+
+#[A1(foo())]
+class C1 { }
+
+?>
+--EXPECTF--
+Fatal error: Constant expression contains invalid operations in %s
diff --git a/Zend/tests/attributes/011_inheritance.phpt b/Zend/tests/attributes/011_inheritance.phpt
new file mode 100644
index 0000000000..6a589b9253
--- /dev/null
+++ b/Zend/tests/attributes/011_inheritance.phpt
@@ -0,0 +1,99 @@
+--TEST--
+Attributes comply with inheritance rules.
+--FILE--
+<?php
+
+#[A2]
+class C1
+{
+ #[A1]
+ public function foo() { }
+}
+
+class C2 extends C1
+{
+ public function foo() { }
+}
+
+class C3 extends C1
+{
+ #[A1]
+ public function bar() { }
+}
+
+$ref = new \ReflectionClass(C1::class);
+print_r(array_map(fn ($a) => $a->getName(), $ref->getAttributes()));
+print_r(array_map(fn ($a) => $a->getName(), $ref->getMethod('foo')->getAttributes()));
+
+$ref = new \ReflectionClass(C2::class);
+print_r(array_map(fn ($a) => $a->getName(), $ref->getAttributes()));
+print_r(array_map(fn ($a) => $a->getName(), $ref->getMethod('foo')->getAttributes()));
+
+$ref = new \ReflectionClass(C3::class);
+print_r(array_map(fn ($a) => $a->getName(), $ref->getAttributes()));
+print_r(array_map(fn ($a) => $a->getName(), $ref->getMethod('foo')->getAttributes()));
+
+echo "\n";
+
+trait T1
+{
+ #[A2]
+ public $a;
+}
+
+class C4
+{
+ use T1;
+}
+
+class C5
+{
+ use T1;
+
+ public $a;
+}
+
+$ref = new \ReflectionClass(T1::class);
+print_r(array_map(fn ($a) => $a->getName(), $ref->getProperty('a')->getAttributes()));
+
+$ref = new \ReflectionClass(C4::class);
+print_r(array_map(fn ($a) => $a->getName(), $ref->getProperty('a')->getAttributes()));
+
+$ref = new \ReflectionClass(C5::class);
+print_r(array_map(fn ($a) => $a->getName(), $ref->getProperty('a')->getAttributes()));
+
+?>
+--EXPECT--
+Array
+(
+ [0] => A2
+)
+Array
+(
+ [0] => A1
+)
+Array
+(
+)
+Array
+(
+)
+Array
+(
+)
+Array
+(
+ [0] => A1
+)
+
+Array
+(
+ [0] => A2
+)
+Array
+(
+ [0] => A2
+)
+Array
+(
+)
diff --git a/Zend/tests/attributes/012_ast_export.phpt b/Zend/tests/attributes/012_ast_export.phpt
new file mode 100644
index 0000000000..347d1befe7
--- /dev/null
+++ b/Zend/tests/attributes/012_ast_export.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Attributes AST can be exported.
+--INI--
+zend.assertions=1
+assert.exception=0
+assert.warning=1
+--FILE--
+<?php
+
+assert(0 && ($a = #[A1] #[A2] function ($a, #[A3(1)] $b) { }));
+
+assert(0 && ($a = #[A1(1, 2, 1 + 2)] fn () => 1));
+
+assert(0 && ($a = new #[A1] class() {
+ #[A1]#[A2] const FOO = 'foo';
+ #[A2] public $x;
+ #[A3] function a() { }
+}));
+
+assert(0 && ($a = function () {
+ #[A1] class Test1 { }
+ #[A2] interface Test2 { }
+ #[A3] trait Test3 { }
+}));
+
+?>
+--EXPECTF--
+Warning: assert(): assert(0 && ($a = #[A1] #[A2] function ($a, #[A3(1)] $b) {
+})) failed in %s on line %d
+
+Warning: assert(): assert(0 && ($a = #[A1(1, 2, 1 + 2)] fn() => 1)) failed in %s on line %d
+
+Warning: assert(): assert(0 && ($a = new #[A1] class {
+ #[A1]
+ #[A2]
+ public const FOO = 'foo';
+ #[A2]
+ public $x;
+ #[A3]
+ public function a() {
+ }
+
+})) failed in %s on line %d
+
+Warning: assert(): assert(0 && ($a = function () {
+ #[A1]
+ class Test1 {
+ }
+
+ #[A2]
+ interface Test2 {
+ }
+
+ #[A3]
+ trait Test3 {
+ }
+
+})) failed in %s on line %d
diff --git a/Zend/tests/attributes/013_class_scope.phpt b/Zend/tests/attributes/013_class_scope.phpt
new file mode 100644
index 0000000000..ff16bb7b82
--- /dev/null
+++ b/Zend/tests/attributes/013_class_scope.phpt
@@ -0,0 +1,117 @@
+--TEST--
+Attributes make use of class scope.
+--FILE--
+<?php
+
+#[A1(self::class, self::FOO)]
+class C1
+{
+ #[A1(self::class, self::FOO)]
+ private const FOO = 'foo';
+
+ #[A1(self::class, self::FOO)]
+ public $a;
+
+ #[A1(self::class, self::FOO)]
+ public function bar(#[A1(self::class, self::FOO)] $p) { }
+}
+
+$ref = new \ReflectionClass(C1::class);
+print_r($ref->getAttributes()[0]->getArguments());
+print_r($ref->getReflectionConstant('FOO')->getAttributes()[0]->getArguments());
+print_r($ref->getProperty('a')->getAttributes()[0]->getArguments());
+print_r($ref->getMethod('bar')->getAttributes()[0]->getArguments());
+print_r($ref->getMethod('bar')->getParameters()[0]->getAttributes()[0]->getArguments());
+
+echo "\n";
+
+trait T1
+{
+ #[A1(self::class, self::FOO)]
+ public function foo() { }
+}
+
+class C2
+{
+ use T1;
+
+ private const FOO = 'bar';
+}
+
+$ref = new \ReflectionClass(C2::class);
+print_r($ref->getMethod('foo')->getAttributes()[0]->getArguments());
+
+$ref = new \ReflectionClass(T1::class);
+$attr = $ref->getMethod('foo')->getAttributes()[0];
+
+try {
+ $attr->getArguments();
+} catch (\Error $e) {
+ var_dump('ERROR 1', $e->getMessage());
+}
+
+echo "\n";
+
+class C3
+{
+ private const FOO = 'foo';
+
+ public static function foo()
+ {
+ return new #[A1(self::class, self::FOO)] class() {
+ private const FOO = 'bar';
+
+ #[A1(self::class, self::FOO)]
+ public function bar() { }
+ };
+ }
+}
+
+$ref = new \ReflectionObject(C3::foo());
+
+$args = $ref->getAttributes()[0]->getArguments();
+var_dump($args[0] == $ref->getName(), $args[1]);
+
+$args = $ref->getMethod('bar')->getAttributes()[0]->getArguments();
+var_dump($args[0] == $ref->getName(), $args[1]);
+
+?>
+--EXPECT--
+Array
+(
+ [0] => C1
+ [1] => foo
+)
+Array
+(
+ [0] => C1
+ [1] => foo
+)
+Array
+(
+ [0] => C1
+ [1] => foo
+)
+Array
+(
+ [0] => C1
+ [1] => foo
+)
+Array
+(
+ [0] => C1
+ [1] => foo
+)
+
+Array
+(
+ [0] => C2
+ [1] => bar
+)
+string(7) "ERROR 1"
+string(28) "Undefined constant self::FOO"
+
+bool(true)
+string(3) "bar"
+bool(true)
+string(3) "bar"
diff --git a/Zend/tests/attributes/014_class_const_group.phpt b/Zend/tests/attributes/014_class_const_group.phpt
new file mode 100644
index 0000000000..726483a2dc
--- /dev/null
+++ b/Zend/tests/attributes/014_class_const_group.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Attributes can be applied to groups of class constants
+--FILE--
+<?php
+
+class C
+{
+ #[A(1, X)]
+ public const A = 1, B = 2;
+}
+
+const X = 2;
+
+$rp1 = new ReflectionClassConstant('C', 'A');
+$ra1 = $rp1->getAttributes()[0];
+var_dump($ra1->getName(), $ra1->getArguments());
+$rp2 = new ReflectionClassConstant('C', 'B');
+$ra2 = $rp2->getAttributes()[0];
+var_dump($ra2->getName(), $ra2->getArguments());
+
+?>
+--EXPECT--
+string(1) "A"
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+string(1) "A"
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
diff --git a/Zend/tests/attributes/015_property_group.phpt b/Zend/tests/attributes/015_property_group.phpt
new file mode 100644
index 0000000000..a448cb80d6
--- /dev/null
+++ b/Zend/tests/attributes/015_property_group.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Attributes can be applied to groups of properties
+--FILE--
+<?php
+
+class C
+{
+ #[A(1, X)]
+ public $x, $y;
+}
+
+const X = 2;
+
+$rp1 = new ReflectionProperty('C', 'x');
+$ra1 = $rp1->getAttributes()[0];
+var_dump($ra1->getName(), $ra1->getArguments());
+$rp2 = new ReflectionProperty('C', 'y');
+$ra2 = $rp2->getAttributes()[0];
+var_dump($ra2->getName(), $ra2->getArguments());
+
+?>
+--EXPECT--
+string(1) "A"
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
+string(1) "A"
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+}
diff --git a/Zend/tests/attributes/016_custom_attribute_validation.phpt b/Zend/tests/attributes/016_custom_attribute_validation.phpt
new file mode 100644
index 0000000000..0f3167f986
--- /dev/null
+++ b/Zend/tests/attributes/016_custom_attribute_validation.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Attribute validation callback of internal attributes.
+--SKIPIF--
+<?php
+if (!extension_loaded('zend-test')) {
+ echo "skip requires zend-test extension\n";
+}
+--FILE--
+<?php
+
+#[ZendTestAttribute]
+function foo() {
+}
+?>
+--EXPECTF--
+Fatal error: Only classes can be marked with #[ZendTestAttribute] in %s
diff --git a/Zend/tests/attributes/017_closure_scope.phpt b/Zend/tests/attributes/017_closure_scope.phpt
new file mode 100644
index 0000000000..8c39ceede9
--- /dev/null
+++ b/Zend/tests/attributes/017_closure_scope.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Attributes make use of closure scope.
+--FILE--
+<?php
+
+class Test1
+{
+ private const FOO = 'bar';
+}
+
+class C1
+{
+ private const FOO = 'foo';
+
+ public static function foo()
+ {
+ return #[A1(self::class, self::FOO)] function (#[A1(self::class, self::FOO)] $p) { };
+ }
+}
+
+$ref = new \ReflectionFunction(C1::foo());
+print_r($ref->getAttributes()[0]->getArguments());
+print_r($ref->getParameters()[0]->getAttributes()[0]->getArguments());
+
+echo "\n";
+
+$ref = new \ReflectionFunction(C1::foo()->bindTo(null, Test1::class));
+print_r($ref->getAttributes()[0]->getArguments());
+print_r($ref->getParameters()[0]->getAttributes()[0]->getArguments());
+
+?>
+--EXPECT--
+Array
+(
+ [0] => C1
+ [1] => foo
+)
+Array
+(
+ [0] => C1
+ [1] => foo
+)
+
+Array
+(
+ [0] => Test1
+ [1] => bar
+)
+Array
+(
+ [0] => Test1
+ [1] => bar
+)
diff --git a/Zend/tests/attributes/018_fatal_error_in_argument.phpt b/Zend/tests/attributes/018_fatal_error_in_argument.phpt
new file mode 100644
index 0000000000..fd031f5c2c
--- /dev/null
+++ b/Zend/tests/attributes/018_fatal_error_in_argument.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Don't free uninitialized memory if a fatal error occurs in an attribute argument
+--FILE--
+<?php
+
+#[Attr(a->b::c)]
+function test() {}
+
+?>
+--EXPECTF--
+Fatal error: Dynamic class names are not allowed in compile-time class constant references in %s on line %d
diff --git a/Zend/tests/attributes/019_variable_attribute_name.phpt b/Zend/tests/attributes/019_variable_attribute_name.phpt
new file mode 100644
index 0000000000..fe96459bb3
--- /dev/null
+++ b/Zend/tests/attributes/019_variable_attribute_name.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Attribute name cannot be a variable
+--FILE--
+<?php
+
+#[$x]
+class A {}
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected variable "$x" in %s on line %d
diff --git a/Zend/tests/attributes/020_userland_attribute_validation.phpt b/Zend/tests/attributes/020_userland_attribute_validation.phpt
new file mode 100644
index 0000000000..ce2acb26db
--- /dev/null
+++ b/Zend/tests/attributes/020_userland_attribute_validation.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Attributes expose and verify target and repeatable data.
+--FILE--
+<?php
+
+#[Attribute(Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD)]
+class A1 { }
+
+$ref = new \ReflectionFunction(#[A1] function () { });
+$attr = $ref->getAttributes()[0];
+var_dump($attr->getName(), $attr->getTarget() == Attribute::TARGET_FUNCTION, $attr->isRepeated());
+var_dump(get_class($attr->newInstance()));
+
+echo "\n";
+
+$ref = new \ReflectionObject(new #[A1] class() { });
+$attr = $ref->getAttributes()[0];
+var_dump($attr->getName(), $attr->getTarget() == Attribute::TARGET_CLASS, $attr->isRepeated());
+
+try {
+ $attr->newInstance();
+} catch (\Throwable $e) {
+ var_dump('ERROR 1', $e->getMessage());
+}
+
+echo "\n";
+
+$ref = new \ReflectionFunction(#[A1] #[A1] function () { });
+$attr = $ref->getAttributes()[0];
+var_dump($attr->getName(), $attr->getTarget() == Attribute::TARGET_FUNCTION, $attr->isRepeated());
+
+try {
+ $attr->newInstance();
+} catch (\Throwable $e) {
+ var_dump('ERROR 2', $e->getMessage());
+}
+
+echo "\n";
+
+#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
+class A2 { }
+
+$ref = new \ReflectionObject(new #[A2] #[A2] class() { });
+$attr = $ref->getAttributes()[0];
+var_dump($attr->getName(), $attr->getTarget() == Attribute::TARGET_CLASS, $attr->isRepeated());
+var_dump(get_class($attr->newInstance()));
+
+?>
+--EXPECT--
+string(2) "A1"
+bool(true)
+bool(false)
+string(2) "A1"
+
+string(2) "A1"
+bool(true)
+bool(false)
+string(7) "ERROR 1"
+string(70) "Attribute "A1" cannot target class (allowed targets: function, method)"
+
+string(2) "A1"
+bool(true)
+bool(true)
+string(7) "ERROR 2"
+string(35) "Attribute "A1" must not be repeated"
+
+string(2) "A2"
+bool(true)
+bool(true)
+string(2) "A2"
diff --git a/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt b/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt
new file mode 100644
index 0000000000..7c1bfd2da7
--- /dev/null
+++ b/Zend/tests/attributes/021_attribute_flags_type_is_validated.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Attribute flags type is validated.
+--FILE--
+<?php
+
+#[Attribute("foo")]
+class A1 { }
+
+?>
+--EXPECTF--
+Fatal error: Attribute::__construct(): Argument #1 ($flags) must must be of type int, string given in %s
diff --git a/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt b/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt
new file mode 100644
index 0000000000..72433a9f13
--- /dev/null
+++ b/Zend/tests/attributes/022_attribute_flags_value_is_validated.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Attribute flags value is validated.
+--FILE--
+<?php
+
+#[Attribute(-1)]
+class A1 { }
+
+?>
+--EXPECTF--
+Fatal error: Invalid attribute flags specified in %s
diff --git a/Zend/tests/attributes/023_ast_node_in_validation.phpt b/Zend/tests/attributes/023_ast_node_in_validation.phpt
new file mode 100644
index 0000000000..332d83fe86
--- /dev/null
+++ b/Zend/tests/attributes/023_ast_node_in_validation.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Attribute flags value is validated.
+--FILE--
+<?php
+
+#[Attribute(Foo::BAR)]
+class A1 { }
+
+?>
+--EXPECTF--
+Fatal error: Class "Foo" not found in %s on line %d
diff --git a/Zend/tests/attributes/024_internal_target_validation.phpt b/Zend/tests/attributes/024_internal_target_validation.phpt
new file mode 100644
index 0000000000..e941cf6132
--- /dev/null
+++ b/Zend/tests/attributes/024_internal_target_validation.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Internal attribute targets are validated.
+--FILE--
+<?php
+
+#[Attribute]
+function a1() { }
+
+?>
+--EXPECTF--
+Fatal error: Attribute "Attribute" cannot target function (allowed targets: class) in %s
diff --git a/Zend/tests/attributes/025_internal_repeatable_validation.phpt b/Zend/tests/attributes/025_internal_repeatable_validation.phpt
new file mode 100644
index 0000000000..671a15fba3
--- /dev/null
+++ b/Zend/tests/attributes/025_internal_repeatable_validation.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Internal attribute targets are validated.
+--FILE--
+<?php
+
+#[Attribute]
+#[Attribute]
+class A1 { }
+
+?>
+--EXPECTF--
+Fatal error: Attribute "Attribute" must not be repeated in %s
diff --git a/Zend/tests/attributes/026_unpack_in_args.phpt b/Zend/tests/attributes/026_unpack_in_args.phpt
new file mode 100644
index 0000000000..d7528b5114
--- /dev/null
+++ b/Zend/tests/attributes/026_unpack_in_args.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Cannot use unpacking in attribute argument list
+--FILE--
+<?php
+
+#[MyAttribute(...[1, 2, 3])]
+class Foo { }
+
+?>
+--EXPECTF--
+Fatal error: Cannot use unpacking in attribute argument list in %s on line %d
diff --git a/Zend/tests/attributes/027_trailing_comma_args.phpt b/Zend/tests/attributes/027_trailing_comma_args.phpt
new file mode 100644
index 0000000000..96966c364d
--- /dev/null
+++ b/Zend/tests/attributes/027_trailing_comma_args.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Trailing comma in attribute argument list
+--FILE--
+<?php
+
+#[MyAttribute(
+ "there",
+ "are",
+ "many",
+ "arguments",
+)]
+class Foo { }
+
+$ref = new \ReflectionClass(Foo::class);
+$attr = $ref->getAttributes()[0];
+var_dump($attr->getName(), $attr->getArguments());
+
+?>
+--EXPECT--
+string(11) "MyAttribute"
+array(4) {
+ [0]=>
+ string(5) "there"
+ [1]=>
+ string(3) "are"
+ [2]=>
+ string(4) "many"
+ [3]=>
+ string(9) "arguments"
+}
diff --git a/Zend/tests/attributes/028_grouped.phpt b/Zend/tests/attributes/028_grouped.phpt
new file mode 100644
index 0000000000..9796531bda
--- /dev/null
+++ b/Zend/tests/attributes/028_grouped.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Attributes can be grouped
+--FILE--
+<?php
+
+#[A1(1), A1(2), A2(3)]
+class Foo
+{
+}
+
+#[
+ A1(1),
+ A1(2),
+ A2(3)
+]
+function foo() {}
+
+#[A1, A1, A2]
+function bar() {}
+
+$sources = [
+ new \ReflectionClass(Foo::class),
+ new \ReflectionFunction('foo'),
+ new \ReflectionFunction('bar'),
+];
+
+foreach ($sources as $ref) {
+ $attr = $ref->getAttributes();
+ var_dump(get_class($ref), count($attr));
+
+ foreach ($attr as $a) {
+ printf("%s(%s)\n", $a->getName(), implode(", ", $a->getArguments()));
+ }
+
+ echo "\n";
+}
+?>
+--EXPECT--
+string(15) "ReflectionClass"
+int(3)
+A1(1)
+A1(2)
+A2(3)
+
+string(18) "ReflectionFunction"
+int(3)
+A1(1)
+A1(2)
+A2(3)
+
+string(18) "ReflectionFunction"
+int(3)
+A1()
+A1()
+A2()
diff --git a/Zend/tests/attributes/029_reflect_internal_symbols.phpt b/Zend/tests/attributes/029_reflect_internal_symbols.phpt
new file mode 100644
index 0000000000..d4dc29a0bb
--- /dev/null
+++ b/Zend/tests/attributes/029_reflect_internal_symbols.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Reflect attributes on different kinds of internal symbols
+--FILE--
+<?php
+
+$rf = new ReflectionFunction('unserialize');
+var_dump($rf->getAttributes());
+
+$rc = new ReflectionClass('DateTime');
+var_dump($rc->getAttributes());
+
+$rm = $rc->getMethod('__construct');
+var_dump($rm->getAttributes());
+
+$rcc = $rc->getReflectionConstant('ATOM');
+var_dump($rcc->getAttributes());
+
+$rp = new ReflectionProperty('Exception', 'message');
+var_dump($rp->getAttributes());
+
+?>
+--EXPECT--
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}
diff --git a/Zend/tests/attributes/030_strict_types.inc b/Zend/tests/attributes/030_strict_types.inc
new file mode 100644
index 0000000000..d9494e4fce
--- /dev/null
+++ b/Zend/tests/attributes/030_strict_types.inc
@@ -0,0 +1,5 @@
+<?php
+declare(strict_types=1);
+
+#[MyAttribute("42")]
+class TestStrict {}
diff --git a/Zend/tests/attributes/030_strict_types.phpt b/Zend/tests/attributes/030_strict_types.phpt
new file mode 100644
index 0000000000..d46b4d4a32
--- /dev/null
+++ b/Zend/tests/attributes/030_strict_types.phpt
@@ -0,0 +1,31 @@
+--TEST--
+strict_types=1 of the attribute use-site is respected
+--FILE--
+<?php
+
+#[Attribute]
+class MyAttribute {
+ public function __construct(public int $value) {}
+}
+
+#[MyAttribute("42")]
+class TestWeak {}
+
+require __DIR__ . '/030_strict_types.inc';
+
+var_dump((new ReflectionClass(TestWeak::class))->getAttributes()[0]->newInstance());
+var_dump((new ReflectionClass(TestStrict::class))->getAttributes()[0]->newInstance());
+
+?>
+--EXPECTF--
+object(MyAttribute)#1 (1) {
+ ["value"]=>
+ int(42)
+}
+
+Fatal error: Uncaught TypeError: MyAttribute::__construct(): Argument #1 ($value) must be of type int, string given, called in %s030_strict_types.inc on line 4 and defined in %s030_strict_types.php:5
+Stack trace:
+#0 %s030_strict_types.inc(4): MyAttribute->__construct('42')
+#1 %s(%d): ReflectionAttribute->newInstance()
+#2 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/attributes/031_backtrace.phpt b/Zend/tests/attributes/031_backtrace.phpt
new file mode 100644
index 0000000000..b0374e67e2
--- /dev/null
+++ b/Zend/tests/attributes/031_backtrace.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Backtrace during attribute instance creation
+--FILE--
+<?php
+
+#[Attribute]
+class MyAttribute {
+ public function __construct() {
+ debug_print_backtrace();
+ var_dump(debug_backtrace());
+ var_dump((new Exception)->getTrace());
+ }
+}
+
+#[MyAttribute]
+class Test {}
+
+(new ReflectionClass(Test::class))->getAttributes()[0]->newInstance();
+
+?>
+--EXPECTF--
+#0 MyAttribute->__construct() called at [%s031_backtrace.php:12]
+#1 ReflectionAttribute->newInstance() called at [%s:%d]
+array(2) {
+ [0]=>
+ array(7) {
+ ["file"]=>
+ string(%d) "%s031_backtrace.php"
+ ["line"]=>
+ int(12)
+ ["function"]=>
+ string(11) "__construct"
+ ["class"]=>
+ string(11) "MyAttribute"
+ ["object"]=>
+ object(MyAttribute)#1 (0) {
+ }
+ ["type"]=>
+ string(2) "->"
+ ["args"]=>
+ array(0) {
+ }
+ }
+ [1]=>
+ array(7) {
+ ["file"]=>
+ string(%d) "%s"
+ ["line"]=>
+ int(%d)
+ ["function"]=>
+ string(11) "newInstance"
+ ["class"]=>
+ string(19) "ReflectionAttribute"
+ ["object"]=>
+ object(ReflectionAttribute)#2 (0) {
+ }
+ ["type"]=>
+ string(2) "->"
+ ["args"]=>
+ array(0) {
+ }
+ }
+}
+array(2) {
+ [0]=>
+ array(6) {
+ ["file"]=>
+ string(%d) "%s031_backtrace.php"
+ ["line"]=>
+ int(12)
+ ["function"]=>
+ string(11) "__construct"
+ ["class"]=>
+ string(11) "MyAttribute"
+ ["type"]=>
+ string(2) "->"
+ ["args"]=>
+ array(0) {
+ }
+ }
+ [1]=>
+ array(6) {
+ ["file"]=>
+ string(%d) "%s"
+ ["line"]=>
+ int(%d)
+ ["function"]=>
+ string(11) "newInstance"
+ ["class"]=>
+ string(19) "ReflectionAttribute"
+ ["type"]=>
+ string(2) "->"
+ ["args"]=>
+ array(0) {
+ }
+ }
+}
diff --git a/Zend/tests/attributes/032_attribute_validation_scope.phpt b/Zend/tests/attributes/032_attribute_validation_scope.phpt
new file mode 100644
index 0000000000..039a427254
--- /dev/null
+++ b/Zend/tests/attributes/032_attribute_validation_scope.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Validation for "Attribute" does not use a scope when evaluating constant ASTs
+--FILE--
+<?php
+#[Attribute(parent::x)]
+class x extends y {}
+?>
+--EXPECTF--
+Fatal error: Cannot access "parent" when no class scope is active in %s on line %d
diff --git a/Zend/tests/binary-32bit.phpt b/Zend/tests/binary-32bit.phpt
index 4b87aded4f..b102d22bff 100644
--- a/Zend/tests/binary-32bit.phpt
+++ b/Zend/tests/binary-32bit.phpt
@@ -1,7 +1,5 @@
--TEST--
testing binary literals
---INI--
-precision=14
--SKIPIF--
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
--FILE--
@@ -79,6 +77,7 @@ var_dump(-0b11111111111111111111111111111111);
var_dump(-0b1111111111111111111111111111111);
var_dump(-0b111111111111111111111111111111);
var_dump(-0b1);
+?>
--EXPECT--
int(1)
int(3)
@@ -126,27 +125,27 @@ float(8796093022207)
float(17592186044415)
float(35184372088831)
float(70368744177663)
-float(1.4073748835533E+14)
-float(2.8147497671066E+14)
-float(5.6294995342131E+14)
-float(1.1258999068426E+15)
-float(2.2517998136852E+15)
-float(4.5035996273705E+15)
-float(9.007199254741E+15)
-float(1.8014398509482E+16)
-float(3.6028797018964E+16)
-float(7.2057594037928E+16)
-float(1.4411518807586E+17)
-float(2.8823037615171E+17)
-float(5.7646075230342E+17)
-float(1.1529215046068E+18)
-float(2.3058430092137E+18)
-float(4.6116860184274E+18)
-float(9.2233720368548E+18)
-float(1.844674407371E+19)
-float(-1.844674407371E+19)
-float(-9.2233720368548E+18)
-float(-4.6116860184274E+18)
+float(140737488355327)
+float(281474976710655)
+float(562949953421311)
+float(1125899906842623)
+float(2251799813685247)
+float(4503599627370495)
+float(9007199254740992)
+float(18014398509481984)
+float(36028797018963970)
+float(72057594037927940)
+float(1.4411518807585587E+17)
+float(2.8823037615171174E+17)
+float(5.764607523034234E+17)
+float(1.1529215046068468E+18)
+float(2.3058430092136937E+18)
+float(4.6116860184273874E+18)
+float(9.223372036854775E+18)
+float(1.844674407370955E+19)
+float(-1.844674407370955E+19)
+float(-9.223372036854775E+18)
+float(-4.6116860184273874E+18)
float(-8589934591)
float(-4294967295)
int(-2147483647)
diff --git a/Zend/tests/binary.phpt b/Zend/tests/binary.phpt
index 039cf80ce4..d981c38f75 100644
--- a/Zend/tests/binary.phpt
+++ b/Zend/tests/binary.phpt
@@ -79,6 +79,7 @@ var_dump(-0b1111111111111111111111111111111111111111111111111111111111111111);
var_dump(-0b111111111111111111111111111111111111111111111111111111111111111);
var_dump(-0b11111111111111111111111111111111111111111111111111111111111111);
var_dump(-0b1);
+?>
--EXPECT--
int(1)
int(3)
@@ -143,12 +144,12 @@ int(1152921504606846975)
int(2305843009213693951)
int(4611686018427387903)
int(9223372036854775807)
-float(9223372036854775808)
-float(18446744073709549568)
-float(18446744073709549568)
-float(36893488147419099136)
-float(36893488147419099136)
-float(-18446744073709549568)
+float(9.223372036854776E+18)
+float(1.844674407370955E+19)
+float(1.844674407370955E+19)
+float(3.68934881474191E+19)
+float(3.68934881474191E+19)
+float(-1.844674407370955E+19)
int(-9223372036854775807)
int(-4611686018427387903)
int(-1)
diff --git a/Zend/tests/break_error_001.phpt b/Zend/tests/break_error_001.phpt
index d823f50563..63c9cc3c8e 100644
--- a/Zend/tests/break_error_001.phpt
+++ b/Zend/tests/break_error_001.phpt
@@ -3,7 +3,7 @@
--FILE--
<?php
function foo () {
- break 0;
+ break 0;
}
?>
--EXPECTF--
diff --git a/Zend/tests/break_error_002.phpt b/Zend/tests/break_error_002.phpt
index e78fd7594e..afc889d0fd 100644
--- a/Zend/tests/break_error_002.phpt
+++ b/Zend/tests/break_error_002.phpt
@@ -3,7 +3,7 @@
--FILE--
<?php
function foo () {
- break $x;
+ break $x;
}
?>
--EXPECTF--
diff --git a/Zend/tests/break_error_003.phpt b/Zend/tests/break_error_003.phpt
index fa782343b1..44a0e849ff 100644
--- a/Zend/tests/break_error_003.phpt
+++ b/Zend/tests/break_error_003.phpt
@@ -3,7 +3,7 @@
--FILE--
<?php
function foo () {
- break;
+ break;
}
?>
--EXPECTF--
diff --git a/Zend/tests/break_error_004.phpt b/Zend/tests/break_error_004.phpt
index 1b99a99ee9..e82d96f727 100644
--- a/Zend/tests/break_error_004.phpt
+++ b/Zend/tests/break_error_004.phpt
@@ -3,9 +3,9 @@
--FILE--
<?php
function foo () {
- while (1) {
- break 2;
- }
+ while (1) {
+ break 2;
+ }
}
?>
--EXPECTF--
diff --git a/Zend/tests/bug18556.phpt b/Zend/tests/bug18556.phpt
index da083937c5..94e12097de 100644
--- a/Zend/tests/bug18556.phpt
+++ b/Zend/tests/bug18556.phpt
@@ -23,8 +23,8 @@ echo "\n";
setlocale(LC_ALL, "tr_TR.utf8");
foreach(get_declared_classes() as $class)
{
- if(!class_exists($class))
- echo "$class No Longer Exists!\n";
+ if(!class_exists($class))
+ echo "$class No Longer Exists!\n";
}
echo "Done.\n";
diff --git a/Zend/tests/bug20242.phpt b/Zend/tests/bug20242.phpt
index 064f8235fa..f1223a03c6 100644
--- a/Zend/tests/bug20242.phpt
+++ b/Zend/tests/bug20242.phpt
@@ -8,12 +8,12 @@ $t = new test;
$t->show_method();
class test {
- static function show_static() {
- echo "static\n";
- }
- function show_method() {
- echo "method\n";
- }
+ static function show_static() {
+ echo "static\n";
+ }
+ function show_method() {
+ echo "method\n";
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/bug22836.phpt b/Zend/tests/bug22836.phpt
index 8141f178c6..a9597c4bb4 100644
--- a/Zend/tests/bug22836.phpt
+++ b/Zend/tests/bug22836.phpt
@@ -4,13 +4,13 @@ Bug #22836 (returning references to NULL)
<?php
function &f()
{
- $x = "foo";
- var_dump($x);
- print "'$x'\n";
- return ($a);
+ $x = "foo";
+ var_dump($x);
+ print "'$x'\n";
+ return ($a);
}
for ($i = 0; $i < 8; $i++) {
- $h =& f();
+ $h =& f();
}
?>
--EXPECT--
diff --git a/Zend/tests/bug23104.phpt b/Zend/tests/bug23104.phpt
index 04df3bdeb5..38f7d652a4 100644
--- a/Zend/tests/bug23104.phpt
+++ b/Zend/tests/bug23104.phpt
@@ -4,7 +4,7 @@ Bug #23104 (Hash position not reset for constant arrays)
<?php
function foo($bar = array("a", "b", "c"))
{
- var_dump(current($bar));
+ var_dump(current($bar));
}
foo();
?>
diff --git a/Zend/tests/bug24635.phpt b/Zend/tests/bug24635.phpt
index 7235859d3a..7210f83743 100644
--- a/Zend/tests/bug24635.phpt
+++ b/Zend/tests/bug24635.phpt
@@ -3,21 +3,21 @@ Bug #24635 (crash on dtor calling other functions)
--FILE--
<?php
class SiteClass {
- function __construct() { $this->page = new PageClass(); }
+ function __construct() { $this->page = new PageClass(); }
}
class PageClass {
- function Display() {
- $section = new SectionClass("PageClass::Display");
- }
+ function Display() {
+ $section = new SectionClass("PageClass::Display");
+ }
}
class SectionClass {
- function __construct($comment) {
- $this->Comment = $comment;
- }
- function __destruct() {
- out($this->Comment); // this line doesn't crash PHP
- out("\n<!-- End Section: " . $this->Comment . "-->"); // this line
- }
+ function __construct($comment) {
+ $this->Comment = $comment;
+ }
+ function __destruct() {
+ out($this->Comment); // this line doesn't crash PHP
+ out("\n<!-- End Section: " . $this->Comment . "-->"); // this line
+ }
}
function out($code) { return; }
$site = new SiteClass();
diff --git a/Zend/tests/bug24773.phpt b/Zend/tests/bug24773.phpt
index 4116492807..4c73fd0dd0 100644
--- a/Zend/tests/bug24773.phpt
+++ b/Zend/tests/bug24773.phpt
@@ -2,11 +2,11 @@
Bug #24773 (unset() of integers treated as arrays causes a crash)
--FILE--
<?php
- $array = 'test';
- unset($array["lvl1"]["lvl2"]["b"]);
+ $array = 'test';
+ unset($array["lvl1"]["lvl2"]["b"]);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot use string offset as an array in %s:%d
+Fatal error: Uncaught TypeError: Cannot access offset of type string on string in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug26010.phpt b/Zend/tests/bug26010.phpt
index 9761700bb8..bb5789ae29 100644
--- a/Zend/tests/bug26010.phpt
+++ b/Zend/tests/bug26010.phpt
@@ -3,9 +3,9 @@ Bug #26010 (private / protected variables get exposed by get_object_vars())
--FILE--
<?php
class foo {
- private $private = 'private';
- protected $protected = 'protected';
- public $public = 'public';
+ private $private = 'private';
+ protected $protected = 'protected';
+ public $public = 'public';
}
$data = new foo();
$obj_vars = get_object_vars($data);
diff --git a/Zend/tests/bug26166.phpt b/Zend/tests/bug26166.phpt
index 7a3be86c3f..3e5c6daa21 100644
--- a/Zend/tests/bug26166.phpt
+++ b/Zend/tests/bug26166.phpt
@@ -33,8 +33,8 @@ echo "===NONE===\n";
class NoneTest
{
- function __toString() {
- }
+ function __toString() {
+ }
}
$o = new NoneTest;
@@ -48,24 +48,22 @@ echo "===THROW===\n";
class ErrorTest
{
- function __toString() {
- throw new Exception("This is an error!");
- }
+ function __toString() {
+ throw new Exception("This is an error!");
+ }
}
$o = new ErrorTest;
try {
- echo $o;
+ echo $o;
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
?>
-===DONE===
--EXPECT--
Hello World!
===NONE===
-Method NoneTest::__toString() must return a string value
+NoneTest::__toString(): Return value must be of type string, none returned
===THROW===
This is an error!
-===DONE===
diff --git a/Zend/tests/bug26229.phpt b/Zend/tests/bug26229.phpt
index cf23f157f8..ffc6995f43 100644
--- a/Zend/tests/bug26229.phpt
+++ b/Zend/tests/bug26229.phpt
@@ -13,17 +13,15 @@ $obj = new array_iterator;
try
{
- foreach ($obj as $property => $value)
- {
- var_dump($value);
- }
+ foreach ($obj as $property => $value)
+ {
+ var_dump($value);
+ }
}
catch(Exception $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
Objects returned by array_iterator::getIterator() must be traversable or implement interface Iterator
-===DONE===
diff --git a/Zend/tests/bug26281.phpt b/Zend/tests/bug26281.phpt
index e1888a88dd..9844d31538 100644
--- a/Zend/tests/bug26281.phpt
+++ b/Zend/tests/bug26281.phpt
@@ -2,12 +2,12 @@
Bug #26281 (switch() crash when condition is a string offset)
--FILE--
<?php
- $x = 'abc';
- switch ($x[0]) {
- case 'a':
- echo "no crash\n";
- break;
- }
+ $x = 'abc';
+ switch ($x[0]) {
+ case 'a':
+ echo "no crash\n";
+ break;
+ }
?>
--EXPECT--
no crash
diff --git a/Zend/tests/bug26696.phpt b/Zend/tests/bug26696.phpt
index 14083dfb9f..a55dcf6ee5 100644
--- a/Zend/tests/bug26696.phpt
+++ b/Zend/tests/bug26696.phpt
@@ -5,18 +5,16 @@ Bug #26696 (crash in switch() when string index is used)
$str = 'asdd/?';
$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
- switch ($str[$i]) {
- case '?':
- echo "?+\n";
- break;
- default:
- echo $str[$i].'-';
- break;
- }
+ switch ($str[$i]) {
+ case '?':
+ echo "?+\n";
+ break;
+ default:
+ echo $str[$i].'-';
+ break;
+ }
}
?>
-===DONE===
--EXPECT--
a-s-d-d-/-?+
-===DONE===
diff --git a/Zend/tests/bug26697.phpt b/Zend/tests/bug26697.phpt
index fe269c0364..d5e3592764 100644
--- a/Zend/tests/bug26697.phpt
+++ b/Zend/tests/bug26697.phpt
@@ -1,21 +1,19 @@
--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
spl_autoload_register(function ($name) {
- echo __METHOD__ . "($name)\n";
- var_dump(class_exists('NotExistingClass'));
- echo __METHOD__ . "($name), done\n";
+ echo __METHOD__ . "($name)\n";
+ var_dump(class_exists('NotExistingClass'));
+ echo __METHOD__ . "($name), done\n";
});
var_dump(class_exists('NotExistingClass'));
?>
-===DONE===
--EXPECT--
{closure}(NotExistingClass)
bool(false)
{closure}(NotExistingClass), done
bool(false)
-===DONE===
diff --git a/Zend/tests/bug26698.phpt b/Zend/tests/bug26698.phpt
index 8fbf551b6b..834e0b77c2 100644
--- a/Zend/tests/bug26698.phpt
+++ b/Zend/tests/bug26698.phpt
@@ -7,56 +7,56 @@ ini_set("report_memleaks", 0); // the exception thrown in this test results in
class ObjectOne
{
- function getNone()
- {
- throw new Exception('NONE');
- }
+ function getNone()
+ {
+ throw new Exception('NONE');
+ }
}
class Proxy
{
- function three($a, $b, $c)
- {
- }
+ function three($a, $b, $c)
+ {
+ }
- function callOne()
- {
- try
- {
- $res = new ObjectOne();
- $this->three($res->getNone());
- }
- catch(Exception $e)
- {
- echo 'Caught: '.$e->getMessage()."\n";
- }
- }
+ function callOne()
+ {
+ try
+ {
+ $res = new ObjectOne();
+ $this->three($res->getNone());
+ }
+ catch(Exception $e)
+ {
+ echo 'Caught: '.$e->getMessage()."\n";
+ }
+ }
- function callTwo()
- {
- try
- {
- $res = new ObjectOne();
- $this->three(1, $res->getNone());
- }
- catch(Exception $e)
- {
- echo 'Caught: '.$e->getMessage()."\n";
- }
- }
+ function callTwo()
+ {
+ try
+ {
+ $res = new ObjectOne();
+ $this->three(1, $res->getNone());
+ }
+ catch(Exception $e)
+ {
+ echo 'Caught: '.$e->getMessage()."\n";
+ }
+ }
- function callThree()
- {
- try
- {
- $res = new ObjectOne();
- $this->three(1, 2, $res->getNone());
- }
- catch(Exception $e)
- {
- echo 'Caught: '.$e->getMessage()."\n";
- }
- }
+ function callThree()
+ {
+ try
+ {
+ $res = new ObjectOne();
+ $this->three(1, 2, $res->getNone());
+ }
+ catch(Exception $e)
+ {
+ echo 'Caught: '.$e->getMessage()."\n";
+ }
+ }
}
$p = new Proxy();
@@ -65,9 +65,7 @@ $p->callOne();
$p->callTwo();
$p->callThree();
?>
-===DONE===
--EXPECT--
Caught: NONE
Caught: NONE
Caught: NONE
-===DONE===
diff --git a/Zend/tests/bug26801.phpt b/Zend/tests/bug26801.phpt
index b8cc37aa16..34f1a693fd 100644
--- a/Zend/tests/bug26801.phpt
+++ b/Zend/tests/bug26801.phpt
@@ -6,14 +6,14 @@ Bug #26801 (switch ($a{0}) crash)
$a = '11';
$b = $a[0];
switch ($b) {
- case '-':
- break;
+ case '-':
+ break;
}
$a = '22';
switch ($a[0]) {
- case '-':
- break;
+ case '-':
+ break;
}
?>
diff --git a/Zend/tests/bug26802.phpt b/Zend/tests/bug26802.phpt
index 0ab4760d48..52dc45b3b0 100644
--- a/Zend/tests/bug26802.phpt
+++ b/Zend/tests/bug26802.phpt
@@ -5,7 +5,7 @@ Bug #26802 (Can't call static method using a variable)
function global_func()
{
- echo __METHOD__ . "\n";
+ echo __METHOD__ . "\n";
}
$function = 'global_func';
@@ -13,12 +13,12 @@ $function();
class foo
{
- static $method = 'global_func';
+ static $method = 'global_func';
- static public function foo_func()
- {
- echo __METHOD__ . "\n";
- }
+ static public function foo_func()
+ {
+ echo __METHOD__ . "\n";
+ }
}
/* The following is a BC break with PHP 4 where it would
@@ -30,8 +30,6 @@ foo::$method();
?>
-===DONE===
--EXPECT--
global_func
foo::foo_func
-===DONE===
diff --git a/Zend/tests/bug27304.phpt b/Zend/tests/bug27304.phpt
index 9eb1ececf7..7400a8fa1f 100644
--- a/Zend/tests/bug27304.phpt
+++ b/Zend/tests/bug27304.phpt
@@ -5,10 +5,10 @@ Bug #27304 (Static functions don't function properly)
class Staticexample
{
- static function test()
- {
- var_dump(isset($this));
- }
+ static function test()
+ {
+ var_dump(isset($this));
+ }
}
$b = new Staticexample();
@@ -16,8 +16,6 @@ Staticexample::test();
$b->test();
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
-===DONE===
diff --git a/Zend/tests/bug27669.phpt b/Zend/tests/bug27669.phpt
index 97b15590e2..9cd845e337 100644
--- a/Zend/tests/bug27669.phpt
+++ b/Zend/tests/bug27669.phpt
@@ -2,16 +2,13 @@
Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dynamically)
--FILE--
<?php
- class A {
- function hello() {
- echo "Hello World\n";
- }
- }
- $y[0] = 'hello';
- A::{$y[0]}();
+ class A {
+ static function hello() {
+ echo "Hello World\n";
+ }
+ }
+ $y[0] = 'hello';
+ A::{$y[0]}();
?>
-===DONE===
---EXPECTF--
-Deprecated: Non-static method A::hello() should not be called statically in %s on line %d
+--EXPECT--
Hello World
-===DONE===
diff --git a/Zend/tests/bug27731.phpt b/Zend/tests/bug27731.phpt
index 408e4242ad..655fffd515 100644
--- a/Zend/tests/bug27731.phpt
+++ b/Zend/tests/bug27731.phpt
@@ -2,9 +2,9 @@
Bug #27731 (error_reporing() call inside @ block does not work correctly)
--FILE--
<?php
- error_reporting(E_ALL ^ E_NOTICE);
- @error_reporting(E_WARNING);
- var_dump(error_reporting());
+ error_reporting(E_ALL ^ E_NOTICE);
+ @error_reporting(E_WARNING);
+ var_dump(error_reporting());
?>
--EXPECT--
int(2)
diff --git a/Zend/tests/bug27798.phpt b/Zend/tests/bug27798.phpt
index 2545d9e100..310fd97991 100644
--- a/Zend/tests/bug27798.phpt
+++ b/Zend/tests/bug27798.phpt
@@ -5,34 +5,33 @@ Bug #27798 (private / protected variables not exposed by get_object_vars() insid
class Base
{
- public $Foo = 1;
- protected $Bar = 2;
- private $Baz = 3;
+ public $Foo = 1;
+ protected $Bar = 2;
+ private $Baz = 3;
- function __construct()
- {
- echo __METHOD__ . "\n";
- var_dump(get_object_vars($this));
- }
+ function __construct()
+ {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($this));
+ }
}
class Child extends Base
{
- private $Baz = 4;
+ private $Baz = 4;
- function __construct()
- {
- parent::__construct();
- echo __METHOD__ . "\n";
- var_dump(get_object_vars($this));
- }
+ function __construct()
+ {
+ parent::__construct();
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($this));
+ }
}
var_dump(get_object_vars(new Base));
var_dump(get_object_vars(new Child));
?>
-===DONE===
--EXPECT--
Base::__construct
array(3) {
@@ -69,4 +68,3 @@ array(1) {
["Foo"]=>
int(1)
}
-===DONE===
diff --git a/Zend/tests/bug28442.phpt b/Zend/tests/bug28442.phpt
index 36a6fc6ab9..fd57fef854 100644
--- a/Zend/tests/bug28442.phpt
+++ b/Zend/tests/bug28442.phpt
@@ -44,7 +44,6 @@ var_dump(ClassB::$prop);
var_dump(ClassC::$prop);
?>
-===DONE===
--EXPECT--
===INIT===
string(1) "A"
@@ -62,4 +61,3 @@ string(2) "B2"
string(2) "A2"
string(2) "C2"
string(2) "C2"
-===DONE===
diff --git a/Zend/tests/bug28444.phpt b/Zend/tests/bug28444.phpt
index 464aaef4c7..586976a675 100644
--- a/Zend/tests/bug28444.phpt
+++ b/Zend/tests/bug28444.phpt
@@ -5,39 +5,39 @@ Bug #28444 (Cannot access undefined property for object with overloaded property
class ObjectOne
{
- public $x;
+ public $x;
- function __construct($x)
- {
- $this->x = $x;
- }
+ function __construct($x)
+ {
+ $this->x = $x;
+ }
- function __toString() {
- return "Object";
- }
+ function __toString() {
+ return "Object";
+ }
}
class Overloaded
{
- public $props = array();
- public $x;
+ public $props = array();
+ public $x;
- function __construct($x)
- {
- $this->x = new ObjectOne($x);
- }
+ function __construct($x)
+ {
+ $this->x = new ObjectOne($x);
+ }
- function __get($prop)
- {
- echo __METHOD__ . "($prop)\n";
- return $this->props[$prop];
- }
+ function __get($prop)
+ {
+ echo __METHOD__ . "($prop)\n";
+ return $this->props[$prop];
+ }
- function __set($prop, $val)
- {
- echo __METHOD__ . "($prop,$val)\n";
- $this->props[$prop] = $val;
- }
+ function __set($prop, $val)
+ {
+ echo __METHOD__ . "($prop,$val)\n";
+ $this->props[$prop] = $val;
+ }
}
$y = new Overloaded(2);
var_dump($y->x);
@@ -52,7 +52,6 @@ var_dump($t->x = 5);
var_dump($y->z->x = 6);
?>
-===DONE===
--EXPECT--
object(ObjectOne)#2 (1) {
["x"]=>
@@ -75,4 +74,3 @@ Overloaded::__get(z)
int(5)
Overloaded::__get(z)
int(6)
-===DONE===
diff --git a/Zend/tests/bug29015.phpt b/Zend/tests/bug29015.phpt
index d4231d10b1..b13dc74060 100644
--- a/Zend/tests/bug29015.phpt
+++ b/Zend/tests/bug29015.phpt
@@ -15,7 +15,7 @@ object(stdClass)#1 (1) {
string(10) "string('')"
}
-Fatal error: Uncaught Error: Cannot access property started with '\0' in %s:%d
+Fatal error: Uncaught Error: Cannot access property starting with "\0" in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug29210.phpt b/Zend/tests/bug29210.phpt
index db3a67bee6..e50b7c2905 100644
--- a/Zend/tests/bug29210.phpt
+++ b/Zend/tests/bug29210.phpt
@@ -4,35 +4,35 @@ Bug #29210 (Function is_callable does not support private and protected methods)
<?php
class test_class {
private function test_func1() {
- echo "test_func1\n";
+ echo "test_func1\n";
}
protected function test_func2() {
- echo "test_func2\n";
+ echo "test_func2\n";
}
static private function test_func3() {
- echo "test_func3\n";
+ echo "test_func3\n";
}
static protected function test_func4() {
- echo "test_func4\n";
+ echo "test_func4\n";
}
function test() {
if (is_callable(array($this,'test_func1'))) {
- $this->test_func1();
+ $this->test_func1();
} else {
echo "test_func1 isn't callable from inside\n";
}
if (is_callable(array($this,'test_func2'))) {
- $this->test_func2();
+ $this->test_func2();
} else {
echo "test_func2 isn't callable from inside\n";
}
if (is_callable(array('test_class','test_func3'))) {
- test_class::test_func3();
+ test_class::test_func3();
} else {
echo "test_func3 isn't callable from inside\n";
}
if (is_callable(array('test_class','test_func4'))) {
- test_class::test_func4();
+ test_class::test_func4();
} else {
echo "test_func4 isn't callable from inside\n";
}
@@ -42,22 +42,22 @@ class test_class {
class foo extends test_class {
function test() {
if (is_callable(array($this,'test_func1'))) {
- $this->test_func1();
+ $this->test_func1();
} else {
echo "test_func1 isn't callable from child\n";
}
if (is_callable(array($this,'test_func2'))) {
- $this->test_func2();
+ $this->test_func2();
} else {
echo "test_func2 isn't callable from child\n";
}
if (is_callable(array('test_class','test_func3'))) {
- test_class::test_func3();
+ test_class::test_func3();
} else {
echo "test_func3 isn't callable from child\n";
}
if (is_callable(array('test_class','test_func4'))) {
- test_class::test_func4();
+ test_class::test_func4();
} else {
echo "test_func4 isn't callable from child\n";
}
@@ -67,12 +67,12 @@ class foo extends test_class {
$object = new test_class;
$object->test();
if (is_callable(array($object,'test_func1'))) {
- $object->test_func1();
+ $object->test_func1();
} else {
echo "test_func1 isn't callable from outside\n";
}
if (is_callable(array($object,'test_func2'))) {
- $object->test_func2();
+ $object->test_func2();
} else {
echo "test_func2 isn't callable from outside\n";
}
diff --git a/Zend/tests/bug29368.phpt b/Zend/tests/bug29368.phpt
index 1987fa9b45..ae6139efc6 100644
--- a/Zend/tests/bug29368.phpt
+++ b/Zend/tests/bug29368.phpt
@@ -5,30 +5,28 @@ Bug #29368 (The destructor is called when an exception is thrown from the constr
class Foo
{
- function __construct()
- {
- echo __METHOD__ . "\n";
- throw new Exception;
- }
- function __destruct()
- {
- echo __METHOD__ . "\n";
- }
+ function __construct()
+ {
+ echo __METHOD__ . "\n";
+ throw new Exception;
+ }
+ function __destruct()
+ {
+ echo __METHOD__ . "\n";
+ }
}
try
{
- $bar = new Foo;
+ $bar = new Foo;
} catch(Exception $exc)
{
- echo "Caught exception!\n";
+ echo "Caught exception!\n";
}
unset($bar);
?>
-===DONE===
--EXPECT--
Foo::__construct
Caught exception!
-===DONE===
diff --git a/Zend/tests/bug29368_2.phpt b/Zend/tests/bug29368_2.phpt
index acecefcb9b..e13d6da884 100644
--- a/Zend/tests/bug29368_2.phpt
+++ b/Zend/tests/bug29368_2.phpt
@@ -3,16 +3,16 @@ Bug #29368.2 (The destructor is called when an exception is thrown from the cons
--FILE--
<?php
class Bomb {
- function foo() {
- }
- function __destruct() {
- throw new Exception("bomb!");
- }
+ function foo() {
+ }
+ function __destruct() {
+ throw new Exception("bomb!");
+ }
}
try {
- $x = new ReflectionMethod(new Bomb(), "foo");
+ $x = new ReflectionMethod(new Bomb(), "foo");
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
echo "ok\n";
?>
diff --git a/Zend/tests/bug29368_3.phpt b/Zend/tests/bug29368_3.phpt
index fafcc2a0ef..5193a91c89 100644
--- a/Zend/tests/bug29368_3.phpt
+++ b/Zend/tests/bug29368_3.phpt
@@ -3,27 +3,27 @@ Bug #29368.3 (The destructor is called when an exception is thrown from the cons
--FILE--
<?php
class Foo {
- function __construct() {
- echo __METHOD__ . "\n";
- }
- function __destruct() {
- echo __METHOD__ . "\n";
- }
+ function __construct() {
+ echo __METHOD__ . "\n";
+ }
+ function __destruct() {
+ echo __METHOD__ . "\n";
+ }
}
class Bar {
- function __construct() {
- echo __METHOD__ . "\n";
- throw new Exception;
- }
- function __destruct() {
- echo __METHOD__ . "\n";
- }
+ function __construct() {
+ echo __METHOD__ . "\n";
+ throw new Exception;
+ }
+ function __destruct() {
+ echo __METHOD__ . "\n";
+ }
}
try {
- new Foo() + new Bar();
+ new Foo() + new Bar();
} catch(Exception $exc) {
- echo "Caught exception!\n";
+ echo "Caught exception!\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/bug29505.phpt b/Zend/tests/bug29505.phpt
index 4d7c053516..a52ea66929 100644
--- a/Zend/tests/bug29505.phpt
+++ b/Zend/tests/bug29505.phpt
@@ -11,7 +11,6 @@ class Test {
var_dump(get_class_vars('Test'));
?>
-===DONE===
--EXPECT--
array(2) {
["empty"]=>
@@ -28,4 +27,3 @@ array(2) {
}
}
}
-===DONE===
diff --git a/Zend/tests/bug29674.phpt b/Zend/tests/bug29674.phpt
index 60f08a6df2..b9cb4230fe 100644
--- a/Zend/tests/bug29674.phpt
+++ b/Zend/tests/bug29674.phpt
@@ -5,18 +5,18 @@ Bug #29674 (inherited method doesn't have access to private variables of the der
class BaseClass
{
- private $private_base = "Base";
+ private $private_base = "Base";
- function printVars ()
- {
- var_dump($this->private_base);
- var_dump($this->private_child);
- }
+ function printVars ()
+ {
+ var_dump($this->private_base);
+ var_dump($this->private_child);
+ }
}
class ChildClass extends BaseClass
{
- private $private_child = "Child";
+ private $private_child = "Child";
}
echo "===BASE===\n";
@@ -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..21fe5b4d0b 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..b32a25e8d9 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/bug30140.phpt b/Zend/tests/bug30140.phpt
index 1dfb83500f..157e7071cc 100644
--- a/Zend/tests/bug30140.phpt
+++ b/Zend/tests/bug30140.phpt
@@ -3,9 +3,9 @@ Bug #30140 (Problem with array in static properties)
--FILE--
<?php
class A {
- public static $test1 = true;
- public static $test2 = array();
- public static $test3 = "str";
+ public static $test1 = true;
+ public static $test2 = array();
+ public static $test3 = "str";
}
class B extends A {
diff --git a/Zend/tests/bug30162.phpt b/Zend/tests/bug30162.phpt
index 55d26a3e3a..808720b88f 100644
--- a/Zend/tests/bug30162.phpt
+++ b/Zend/tests/bug30162.phpt
@@ -4,35 +4,35 @@ Bug #30162 (Catching exception in constructor couses lose of $this)
<?php
class FIIFO {
- public function __construct() {
- $this->x = "x";
- throw new Exception;
- }
+ public function __construct() {
+ $this->x = "x";
+ throw new Exception;
+ }
}
class hariCow extends FIIFO {
- public function __construct() {
- try {
- parent::__construct();
- } catch(Exception $e) {
- }
- $this->y = "y";
- try {
- $this->z = new FIIFO;
- } catch(Exception $e) {
- }
- }
-
- public function __toString() {
- return "Rusticus in asino sedet.";
- }
+ public function __construct() {
+ try {
+ parent::__construct();
+ } catch(Exception $e) {
+ }
+ $this->y = "y";
+ try {
+ $this->z = new FIIFO;
+ } catch(Exception $e) {
+ }
+ }
+
+ public function __toString() {
+ return "Rusticus in asino sedet.";
+ }
}
try {
- $db = new FIIFO();
+ $db = new FIIFO();
} catch(Exception $e) {
}
var_dump($db);
@@ -41,9 +41,8 @@ $db = new hariCow;
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"]=>
@@ -51,4 +50,3 @@ object(hariCow)#%d (2) {
["y"]=>
string(1) "y"
}
-===DONE===
diff --git a/Zend/tests/bug30346.phpt b/Zend/tests/bug30346.phpt
index 8db080f820..3a4caa6f7a 100644
--- a/Zend/tests/bug30346.phpt
+++ b/Zend/tests/bug30346.phpt
@@ -18,7 +18,5 @@ echo $post[$id.'_show'];
echo "\n";
?>
-===DONE===
--EXPECT--
page_show
-===DONE===
diff --git a/Zend/tests/bug30394.phpt b/Zend/tests/bug30394.phpt
index 516bea2d2d..895326359b 100644
--- a/Zend/tests/bug30394.phpt
+++ b/Zend/tests/bug30394.phpt
@@ -4,17 +4,17 @@ Bug #30394 (Assignment operators yield wrong result with __get/__set)
<?php
class Container
{
- public function __get( $what )
- {
- return $this->_p[ $what ];
- }
+ public function __get( $what )
+ {
+ return $this->_p[ $what ];
+ }
- public function __set( $what, $value )
- {
- $this->_p[ $what ] = $value;
- }
+ public function __set( $what, $value )
+ {
+ $this->_p[ $what ] = $value;
+ }
- private $_p = array();
+ private $_p = array();
}
$c = new Container();
diff --git a/Zend/tests/bug30407.phpt b/Zend/tests/bug30407.phpt
index 6dcc6b3481..16cadaa780 100644
--- a/Zend/tests/bug30407.phpt
+++ b/Zend/tests/bug30407.phpt
@@ -4,15 +4,13 @@ Bug #30407 (Strange behaviour of default arguments)
<?php
function haricow($a = 'one') {
- var_dump($a);
- $a = 'two';
+ var_dump($a);
+ $a = 'two';
}
haricow();
haricow();
?>
-===DONE===
--EXPECT--
string(3) "one"
string(3) "one"
-===DONE===
diff --git a/Zend/tests/bug30451.phpt b/Zend/tests/bug30451.phpt
index 5e9696f128..2c3b62788d 100644
--- a/Zend/tests/bug30451.phpt
+++ b/Zend/tests/bug30451.phpt
@@ -5,25 +5,25 @@ Bug #30451 (static properties permissions broken)
class A {
- protected static $property = TRUE;
+ protected static $property = TRUE;
- protected static function method() {
- return TRUE;
- }
+ protected static function method() {
+ return TRUE;
+ }
}
class B extends A {
- public function __construct() {
+ public function __construct() {
- var_dump(self::method());
- var_dump(parent::method());
+ var_dump(self::method());
+ var_dump(parent::method());
- var_dump(self::$property);
- var_dump(parent::$property);
+ var_dump(self::$property);
+ var_dump(parent::$property);
- }
+ }
}
diff --git a/Zend/tests/bug30519.phpt b/Zend/tests/bug30519.phpt
index f6c7d15bc8..c449bfdfb3 100644
--- a/Zend/tests/bug30519.phpt
+++ b/Zend/tests/bug30519.phpt
@@ -6,7 +6,7 @@ class test implements a {
}
?>
--EXPECTF--
-Fatal error: Uncaught Error: Interface 'a' not found in %s:%d
+Fatal error: Uncaught Error: Interface "a" not found in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug30702.phpt b/Zend/tests/bug30702.phpt
index f23b1ecd44..e9bb585859 100644
--- a/Zend/tests/bug30702.phpt
+++ b/Zend/tests/bug30702.phpt
@@ -3,7 +3,7 @@ Bug #30702 (cannot initialize class variable from class constant)
--FILE--
<?php
class foo {
- const C1=1;
+ const C1=1;
}
class bar extends foo {
diff --git a/Zend/tests/bug30707.phpt b/Zend/tests/bug30707.phpt
index 89db55c36a..17ccb17c19 100644
--- a/Zend/tests/bug30707.phpt
+++ b/Zend/tests/bug30707.phpt
@@ -3,23 +3,23 @@ Bug #30707 (Segmentation fault on exception in method)
--FILE--
<?php
class C {
- function byePHP($plop) {
- echo "ok\n";
- }
+ function byePHP($plop) {
+ echo "ok\n";
+ }
- function plip() {
- try {
- $this->plap($this->plop());
- } catch(Exception $e) {
- }
- }
+ function plip() {
+ try {
+ $this->plap($this->plop());
+ } catch(Exception $e) {
+ }
+ }
- function plap($a) {
- }
+ function plap($a) {
+ }
- function plop() {
- throw new Exception;
- }
+ function plop() {
+ throw new Exception;
+ }
}
$x = new C;
diff --git a/Zend/tests/bug30725.phpt b/Zend/tests/bug30725.phpt
index 75cb04843c..b2ed209bcd 100644
--- a/Zend/tests/bug30725.phpt
+++ b/Zend/tests/bug30725.phpt
@@ -5,28 +5,26 @@ Bug #30725 (PHP segfaults when an exception is thrown in getIterator() within fo
class Test implements IteratorAggregate
{
- function getIterator()
- {
- throw new Exception();
- }
+ function getIterator()
+ {
+ throw new Exception();
+ }
}
try
{
- $it = new Test;
- foreach($it as $v)
- {
- echo "Fail\n";
- }
- echo "Wrong\n";
+ $it = new Test;
+ foreach($it as $v)
+ {
+ echo "Fail\n";
+ }
+ echo "Wrong\n";
}
catch(Exception $e)
{
- echo "Caught\n";
+ echo "Caught\n";
}
?>
-===DONE===
--EXPECT--
Caught
-===DONE===
diff --git a/Zend/tests/bug30828.phpt b/Zend/tests/bug30828.phpt
index d05dbb606d..4e921403b7 100644
--- a/Zend/tests/bug30828.phpt
+++ b/Zend/tests/bug30828.phpt
@@ -3,43 +3,43 @@ Bug #30828 (debug_backtrace() reports incorrect class in overridden methods)
--FILE--
<?php
class A {
- function __construct() {
- debug_print_backtrace();
- $bt = debug_backtrace();
- foreach ($bt as $t) {
- print $t['class'].$t['type'].$t['function']."\n";
- }
- }
+ function __construct() {
+ debug_print_backtrace();
+ $bt = debug_backtrace();
+ foreach ($bt as $t) {
+ print $t['class'].$t['type'].$t['function']."\n";
+ }
+ }
- function foo() {
- debug_print_backtrace();
- $bt = debug_backtrace();
- foreach ($bt as $t) {
+ function foo() {
+ debug_print_backtrace();
+ $bt = debug_backtrace();
+ foreach ($bt as $t) {
print $t['class'].$t['type'].$t['function']."\n";
- }
- }
+ }
+ }
- static function bar() {
- debug_print_backtrace();
- $bt = debug_backtrace();
- foreach ($bt as $t) {
- print $t['class'].$t['type'].$t['function']."\n";
- }
- }
+ static function bar() {
+ debug_print_backtrace();
+ $bt = debug_backtrace();
+ foreach ($bt as $t) {
+ print $t['class'].$t['type'].$t['function']."\n";
+ }
+ }
}
class B extends A {
- function __construct() {
- parent::__construct();
- }
+ function __construct() {
+ parent::__construct();
+ }
- function foo() {
- parent::foo();
- }
+ function foo() {
+ parent::foo();
+ }
- static function bar() {
- parent::bar();
- }
+ static function bar() {
+ parent::bar();
+ }
}
$b = new B();
diff --git a/Zend/tests/bug30922.phpt b/Zend/tests/bug30922.phpt
index 7a0316bee8..47802c1afa 100644
--- a/Zend/tests/bug30922.phpt
+++ b/Zend/tests/bug30922.phpt
@@ -10,7 +10,7 @@ var_dump($a instanceOf A);
echo "ok\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Interface 'RecurisiveFooFar' not found in %s:%d
+Fatal error: Uncaught Error: Interface "RecurisiveFooFar" not found in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug30998.phpt b/Zend/tests/bug30998.phpt
index 2ff3068e5c..9d84351216 100644
--- a/Zend/tests/bug30998.phpt
+++ b/Zend/tests/bug30998.phpt
@@ -13,9 +13,7 @@ set_error_handler('my_error');
$f = fopen("/tmp/blah", "r");
?>
-===DONE===
--EXPECTF--
-fopen(/tmp/blah): failed to open stream: %s (2) in %s:%d
+fopen(/tmp/blah): Failed to open stream: %s (2) in %s:%d
-Warning: fopen(/tmp/blah): failed to open stream: %s in %s on line %d
-===DONE===
+Warning: fopen(/tmp/blah): Failed to open stream: %s in %s on line %d
diff --git a/Zend/tests/bug31098.phpt b/Zend/tests/bug31098.phpt
index 1849528231..1cad1108c0 100644
--- a/Zend/tests/bug31098.phpt
+++ b/Zend/tests/bug31098.phpt
@@ -17,16 +17,28 @@ var_dump(isset($a['b']));
$simpleString = "Bogus String Text";
echo isset($simpleString->wrong)?"bug\n":"ok\n";
-echo isset($simpleString["wrong"])?"bug\n":"ok\n";
+try {
+ echo isset($simpleString["wrong"])?"bug\n":"ok\n";
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo isset($simpleString[-20])?"bug\n":"ok\n";
echo isset($simpleString[0])?"ok\n":"bug\n";
echo isset($simpleString["0"])?"ok\n":"bug\n";
echo isset($simpleString["16"])?"ok\n":"bug\n";
echo isset($simpleString["17"])?"bug\n":"ok\n";
echo $simpleString->wrong === null?"ok\n":"bug\n";
-echo $simpleString["wrong"] === "B"?"ok\n":"bug\n";
+try {
+ echo $simpleString["wrong"] === "B"?"ok\n":"bug\n";
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
-$simpleString["wrong"] = "f";
+try {
+ $simpleString["wrong"] = "f";
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo $simpleString["0"] === "f"?"ok\n":"bug\n";
?>
--EXPECTF--
@@ -44,12 +56,9 @@ ok
ok
ok
-Notice: Trying to get property 'wrong' of non-object in %s on line %d
-ok
-
-Warning: Illegal string offset 'wrong' in %s on line %d
+Warning: Attempt to read property "wrong" on string in %s on line %d
ok
+Cannot access offset of type string on string
ok
-
-Warning: Illegal string offset 'wrong' in %s on line %d
+Cannot access offset of type string on string
ok
diff --git a/Zend/tests/bug31102.phpt b/Zend/tests/bug31102.phpt
index fd6da0f7c2..3f25aa00e0 100644
--- a/Zend/tests/bug31102.phpt
+++ b/Zend/tests/bug31102.phpt
@@ -1,42 +1,41 @@
--TEST--
-Bug #31102 (Exception not handled when thrown inside __autoload())
+Bug #31102 (Exception not handled when thrown inside autoloader)
--FILE--
<?php
$test = 0;
spl_autoload_register(function ($class) {
- global $test;
+ global $test;
- echo __METHOD__ . "($class,$test)\n";
- switch($test)
- {
- case 1:
- eval("class $class { function __construct(){throw new Exception('$class::__construct');}}");
- return;
- case 2:
- eval("class $class { function __construct(){throw new Exception('$class::__construct');}}");
- throw new Exception(__METHOD__);
- return;
- case 3:
- return;
- }
+ echo __METHOD__ . "($class,$test)\n";
+ switch($test)
+ {
+ case 1:
+ eval("class $class { function __construct(){throw new Exception('$class::__construct');}}");
+ return;
+ case 2:
+ eval("class $class { function __construct(){throw new Exception('$class::__construct');}}");
+ throw new Exception(__METHOD__);
+ return;
+ case 3:
+ return;
+ }
});
while($test++ < 5)
{
- try
- {
- eval("\$bug = new Test$test();");
- }
- catch (Exception $e)
- {
- echo "Caught: " . $e->getMessage() . "\n";
- }
+ try
+ {
+ eval("\$bug = new Test$test();");
+ }
+ catch (Exception $e)
+ {
+ echo "Caught: " . $e->getMessage() . "\n";
+ }
}
?>
===DONE===
-<?php exit(0); ?>
--EXPECTF--
{closure}(Test1,1)
Caught: Test1::__construct
@@ -44,7 +43,7 @@ Caught: Test1::__construct
Caught: {closure}
{closure}(Test3,3)
-Fatal error: Uncaught Error: Class 'Test3' not found in %sbug31102.php(%d) : eval()'d code:1
+Fatal error: Uncaught Error: Class "Test3" not found in %s:%d
Stack trace:
#0 %s(%d): eval()
#1 {main}
diff --git a/Zend/tests/bug31177-2.phpt b/Zend/tests/bug31177-2.phpt
index 6cba62cedf..182e222973 100644
--- a/Zend/tests/bug31177-2.phpt
+++ b/Zend/tests/bug31177-2.phpt
@@ -13,6 +13,7 @@ try {
} catch (Exception $e) {
var_dump($x);
}
+?>
--EXPECT--
object(foo)#1 (0) {
}
diff --git a/Zend/tests/bug31177.phpt b/Zend/tests/bug31177.phpt
index c443420118..2cd3dac920 100644
--- a/Zend/tests/bug31177.phpt
+++ b/Zend/tests/bug31177.phpt
@@ -4,39 +4,39 @@ Bug #31177 (Memory leak)
<?php
class DbGow {
- public function query() {
- throw new Exception;
- }
+ public function query() {
+ throw new Exception;
+ }
- public function select() {
- return new DbGowRecordSet($this->query());
- }
+ public function select() {
+ return new DbGowRecordSet($this->query());
+ }
- public function select2() {
- new DbGowRecordSet($this->query());
- }
+ public function select2() {
+ new DbGowRecordSet($this->query());
+ }
}
class DbGowRecordSet {
- public function __construct($resource) {
- }
+ public function __construct($resource) {
+ }
}
$db = new DbGow;
try {
- $rs = $db->select();
+ $rs = $db->select();
} catch(Exception $e) {
- echo "ok\n";
+ echo "ok\n";
}
try {
- $db->select2();
+ $db->select2();
} catch(Exception $e) {
- echo "ok\n";
+ echo "ok\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/bug31341.phpt b/Zend/tests/bug31341.phpt
index 309a54d76b..289e03a0ba 100644
--- a/Zend/tests/bug31341.phpt
+++ b/Zend/tests/bug31341.phpt
@@ -3,18 +3,18 @@ Bug #31341 (escape on curly inconsistent)
--FILE--
<?php
$a = array(
- "$ \{ ",
- " \{ $",
- " \{$ ",
- " $\{ ",
- " \$\{ ",
- " \{\$ ",
- "\$ \{ ",
- " \{ \$",
- "% \{ ");
+ "$ \{ ",
+ " \{ $",
+ " \{$ ",
+ " $\{ ",
+ " \$\{ ",
+ " \{\$ ",
+ "\$ \{ ",
+ " \{ \$",
+ "% \{ ");
foreach ($a as $v) {
- echo("'$v'\n");
+ echo("'$v'\n");
}
?>
--EXPECT--
diff --git a/Zend/tests/bug31720.phpt b/Zend/tests/bug31720.phpt
index c4680a4789..083ea78a01 100644
--- a/Zend/tests/bug31720.phpt
+++ b/Zend/tests/bug31720.phpt
@@ -4,11 +4,12 @@ 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
-===DONE===
+Warning: Undefined variable $nonesuchvar in %s on line %d
+array_walk(): Argument #2 ($callback) must be a valid callback, first array member is not a valid class name or object
diff --git a/Zend/tests/bug32226.phpt b/Zend/tests/bug32226.phpt
index f8e13cfb6e..f56f06f107 100644
--- a/Zend/tests/bug32226.phpt
+++ b/Zend/tests/bug32226.phpt
@@ -26,11 +26,9 @@ $a = new A();
}
catch(Exception $e)
{
- echo "Caught\n";
+ echo "Caught\n";
}
?>
-===DONE===
--EXPECT--
Caught
-===DONE===
diff --git a/Zend/tests/bug32252.phpt b/Zend/tests/bug32252.phpt
index 706da18cfb..f138857175 100644
--- a/Zend/tests/bug32252.phpt
+++ b/Zend/tests/bug32252.phpt
@@ -5,28 +5,28 @@ Bug #32252 (Segfault when offsetSet throws an Exception (only without debug))
class Test implements ArrayAccess
{
- function offsetExists($offset)
- {
- echo __METHOD__ . "($offset)\n";
- return false;
- }
+ function offsetExists($offset)
+ {
+ echo __METHOD__ . "($offset)\n";
+ return false;
+ }
- function offsetGet($offset)
- {
- echo __METHOD__ . "($offset)\n";
- return null;
- }
+ function offsetGet($offset)
+ {
+ echo __METHOD__ . "($offset)\n";
+ return null;
+ }
- function offsetSet($offset, $value)
- {
- echo __METHOD__ . "($offset, $value)\n";
- throw new Exception("Ooops");
- }
+ function offsetSet($offset, $value)
+ {
+ echo __METHOD__ . "($offset, $value)\n";
+ throw new Exception("Ooops");
+ }
- function offsetUnset($offset)
- {
- echo __METHOD__ . "($offset)\n";
- }
+ function offsetUnset($offset)
+ {
+ echo __METHOD__ . "($offset)\n";
+ }
}
$list = new Test();
@@ -36,12 +36,10 @@ try
}
catch (Exception $e)
{
- echo "CAUGHT\n";
+ echo "CAUGHT\n";
}
?>
-===DONE===
--EXPECT--
Test::offsetSet(-1, 123)
CAUGHT
-===DONE===
diff --git a/Zend/tests/bug32290.phpt b/Zend/tests/bug32290.phpt
index e73bca12ac..957bbd44a1 100644
--- a/Zend/tests/bug32290.phpt
+++ b/Zend/tests/bug32290.phpt
@@ -7,78 +7,78 @@ error_reporting=8191
class TestA
{
- public function doSomething($i)
- {
- echo __METHOD__ . "($i)\n";
- return --$i;
- }
-
- public function doSomethingThis($i)
- {
- echo __METHOD__ . "($i)\n";
- return --$i;
- }
-
- public function doSomethingParent($i)
- {
- echo __METHOD__ . "($i)\n";
- return --$i;
- }
-
- public function doSomethingParentThis($i)
- {
- echo __METHOD__ . "($i)\n";
- return --$i;
- }
-
- public static function doSomethingStatic($i)
- {
- echo __METHOD__ . "($i)\n";
- return --$i;
- }
+ public function doSomething($i)
+ {
+ echo __METHOD__ . "($i)\n";
+ return --$i;
+ }
+
+ public function doSomethingThis($i)
+ {
+ echo __METHOD__ . "($i)\n";
+ return --$i;
+ }
+
+ public function doSomethingParent($i)
+ {
+ echo __METHOD__ . "($i)\n";
+ return --$i;
+ }
+
+ public function doSomethingParentThis($i)
+ {
+ echo __METHOD__ . "($i)\n";
+ return --$i;
+ }
+
+ public static function doSomethingStatic($i)
+ {
+ echo __METHOD__ . "($i)\n";
+ return --$i;
+ }
}
class TestB extends TestA
{
- public function doSomething($i)
- {
- echo __METHOD__ . "($i)\n";
- $i++;
- if ($i >= 5) return 5;
- return call_user_func_array(array("TestA", "doSomething"), array($i));
- }
-
- public function doSomethingThis($i)
- {
- echo __METHOD__ . "($i)\n";
- $i++;
- if ($i >= 5) return 5;
- return call_user_func_array(array($this, "TestA::doSomethingThis"), array($i));
- }
-
- public function doSomethingParent($i)
- {
- echo __METHOD__ . "($i)\n";
- $i++;
- if ($i >= 5) return 5;
- return call_user_func_array(array("parent", "doSomethingParent"), array($i));
- }
-
- public function doSomethingParentThis($i)
- {
- echo __METHOD__ . "($i)\n";
- $i++;
- if ($i >= 5) return 5;
- return call_user_func_array(array($this, "parent::doSomethingParentThis"), array($i));
- }
-
- public static function doSomethingStatic($i)
- {
- echo __METHOD__ . "($i)\n";
- $i++;
- if ($i >= 5) return 5;
- return call_user_func_array(array("TestA", "doSomethingStatic"), array($i));
- }
+ public function doSomething($i)
+ {
+ echo __METHOD__ . "($i)\n";
+ $i++;
+ if ($i >= 5) return 5;
+ return call_user_func_array(array("TestA", "doSomething"), array($i));
+ }
+
+ public function doSomethingThis($i)
+ {
+ echo __METHOD__ . "($i)\n";
+ $i++;
+ if ($i >= 5) return 5;
+ return call_user_func_array(array($this, "TestA::doSomethingThis"), array($i));
+ }
+
+ public function doSomethingParent($i)
+ {
+ echo __METHOD__ . "($i)\n";
+ $i++;
+ if ($i >= 5) return 5;
+ return call_user_func_array(array("parent", "doSomethingParent"), array($i));
+ }
+
+ public function doSomethingParentThis($i)
+ {
+ echo __METHOD__ . "($i)\n";
+ $i++;
+ if ($i >= 5) return 5;
+ return call_user_func_array(array($this, "parent::doSomethingParentThis"), array($i));
+ }
+
+ public static function doSomethingStatic($i)
+ {
+ echo __METHOD__ . "($i)\n";
+ $i++;
+ if ($i >= 5) return 5;
+ return call_user_func_array(array("TestA", "doSomethingStatic"), array($i));
+ }
}
$x = new TestB();
@@ -94,8 +94,6 @@ echo "\n===E===\n";
var_dump($x->doSomethingStatic(1));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===A===
TestB::doSomething(1)
@@ -121,4 +119,3 @@ int(1)
TestB::doSomethingStatic(1)
TestA::doSomethingStatic(2)
int(1)
-===DONE===
diff --git a/Zend/tests/bug32296.phpt b/Zend/tests/bug32296.phpt
index b3e705ec14..16914a71b4 100644
--- a/Zend/tests/bug32296.phpt
+++ b/Zend/tests/bug32296.phpt
@@ -3,26 +3,26 @@ Bug #32296 (get_class_methods output has changed between 5.0.2 and 5.0.3)
--FILE--
<?php
abstract class space{
- function __construct(){}
- abstract protected function unfold();
+ function __construct(){}
+ abstract protected function unfold();
}
abstract class shape extends space{
- private function x1() {}
- protected final function unfold(){}
+ private function x1() {}
+ protected final function unfold(){}
}
abstract class quad extends shape{
- private function x2() {}
- function buggy(){
- $c = get_class($this);
- $a = get_class_methods(get_class($this));
- $b = get_class_methods($this);
- print($c."\n".'a:');
- print_r($a);
- print('b:');
- print_r($b);
- }
+ private function x2() {}
+ function buggy(){
+ $c = get_class($this);
+ $a = get_class_methods(get_class($this));
+ $b = get_class_methods($this);
+ print($c."\n".'a:');
+ print_r($a);
+ print('b:');
+ print_r($b);
+ }
}
class square extends quad{}
diff --git a/Zend/tests/bug32427.phpt b/Zend/tests/bug32427.phpt
index 9b2d818659..ee41021f51 100644
--- a/Zend/tests/bug32427.phpt
+++ b/Zend/tests/bug32427.phpt
@@ -4,13 +4,13 @@ Bug #32427 (Interfaces are not allowed 'static' access modifier)
<?php
interface Example {
- public static function sillyError();
+ public static function sillyError();
}
class ExampleImpl implements Example {
- public static function sillyError() {
- echo "I am a silly error\n";
- }
+ public static function sillyError() {
+ echo "I am a silly error\n";
+ }
}
ExampleImpl::sillyError();
diff --git a/Zend/tests/bug32429.phpt b/Zend/tests/bug32429.phpt
index b711831afb..c9e7828f02 100644
--- a/Zend/tests/bug32429.phpt
+++ b/Zend/tests/bug32429.phpt
@@ -4,21 +4,21 @@ Bug #32429 (method_exists() always return TRUE if __call method exists)
<?php
class TestClass {
- public function __construct() {
- var_dump(method_exists($this, 'test'));
+ public function __construct() {
+ var_dump(method_exists($this, 'test'));
- if (method_exists($this, 'test')) {
- $this->test();
- }
- }
+ if (method_exists($this, 'test')) {
+ $this->test();
+ }
+ }
- public function __call($name, $args) {
- throw new Exception('Call to undefined method'.get_class($this).'::'.$name.'()');
- }
+ public function __call($name, $args) {
+ throw new Exception('Call to undefined method'.get_class($this).'::'.$name.'()');
+ }
}
try {
- $test = new TestClass;
+ $test = new TestClass;
} catch (Exception $e) {
exit($e->getMessage());
}
diff --git a/Zend/tests/bug32660.phpt b/Zend/tests/bug32660.phpt
index 8651d491f8..1a6e4d8068 100644
--- a/Zend/tests/bug32660.phpt
+++ b/Zend/tests/bug32660.phpt
@@ -4,17 +4,17 @@ Bug #32660 (Assignment by reference causes crash when field access is overloaded
<?php
class A
{
- public $q;
+ public $q;
- function __construct()
- {
- $this->q = 3;//array();
- }
+ function __construct()
+ {
+ $this->q = 3;//array();
+ }
- function __get($name)
- {
- return $this->q;
- }
+ function __get($name)
+ {
+ return $this->q;
+ }
}
$a = new A;
diff --git a/Zend/tests/bug32674.phpt b/Zend/tests/bug32674.phpt
index f932517d9b..8f4cef4157 100644
--- a/Zend/tests/bug32674.phpt
+++ b/Zend/tests/bug32674.phpt
@@ -48,14 +48,14 @@ $obj = new class2();
$col = new collection();
try {
- foreach($col as $co) {
- //irrelevant
- }
- echo 'shouldn`t get here';
- //$dummy = 'this will not crash';
- $obj->dummy = 'this will crash';
+ foreach($col as $co) {
+ //irrelevant
+ }
+ echo 'shouldn`t get here';
+ //$dummy = 'this will not crash';
+ $obj->dummy = 'this will crash';
} catch (Exception $e) {
- echo "ok\n";
+ echo "ok\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/bug32799.phpt b/Zend/tests/bug32799.phpt
index c76daeddef..036d94711d 100644
--- a/Zend/tests/bug32799.phpt
+++ b/Zend/tests/bug32799.phpt
@@ -5,13 +5,13 @@ Bug #32799 (crash: calling the corresponding global var during the destruct)
class test{
public $c=1;
function __destruct (){
- if (!isset($GLOBALS['p'])) {
- echo "NULL\n";
- } else {
- $GLOBALS['p']->c++; // no warning
- print $GLOBALS['p']->c."\n"; // segfault
- var_dump($GLOBALS['p']);
- }
+ if (!isset($GLOBALS['p'])) {
+ echo "NULL\n";
+ } else {
+ $GLOBALS['p']->c++; // no warning
+ print $GLOBALS['p']->c."\n"; // segfault
+ var_dump($GLOBALS['p']);
+ }
}
}
$p=new test;
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/bug33171.phpt b/Zend/tests/bug33171.phpt
index a342e10439..5fb1a30f9a 100644
--- a/Zend/tests/bug33171.phpt
+++ b/Zend/tests/bug33171.phpt
@@ -4,20 +4,20 @@ Bug #33171 (foreach enumerates private fields declared in base classes)
<?php
class A
{
- private $c = "A's c";
+ private $c = "A's c";
}
class B extends A
{
- private $c = "B's c";
+ private $c = "B's c";
- public function go()
- {
- foreach ($this as $key => $val)
- {
- echo "$key => $val\n";
- }
- }
+ public function go()
+ {
+ foreach ($this as $key => $val)
+ {
+ echo "$key => $val\n";
+ }
+ }
};
$x = new B;
diff --git a/Zend/tests/bug33282.phpt b/Zend/tests/bug33282.phpt
index 27f399046e..d75c2684a4 100644
--- a/Zend/tests/bug33282.phpt
+++ b/Zend/tests/bug33282.phpt
@@ -2,11 +2,11 @@
Bug #33282 (Re-assignment by reference does not clear the is_ref flag)
--FILE--
<?php
- $a = array(1, 2, 3);
- $r = &$a[0];
- $r = &$a[1];
- $r = &$a[2];
- var_dump($a);
+ $a = array(1, 2, 3);
+ $r = &$a[0];
+ $r = &$a[1];
+ $r = &$a[2];
+ var_dump($a);
?>
--EXPECT--
array(3) {
diff --git a/Zend/tests/bug33512.phpt b/Zend/tests/bug33512.phpt
index 0a0e4e7b11..dbeee22bab 100644
--- a/Zend/tests/bug33512.phpt
+++ b/Zend/tests/bug33512.phpt
@@ -3,59 +3,59 @@ Bug #33512 (unset() overloaded properties doesn't work)
--FILE--
<?php
class TheObj {
- public $RealVar1, $RealVar2, $RealVar3, $RealVar4;
- public $Var = array();
+ public $RealVar1, $RealVar2, $RealVar3, $RealVar4;
+ public $Var = array();
- function __set($var, $val) {
- $this->Var[$var] = $val;
- }
- function __get($var) {
- if(isset($this->Var[$var])) return $this->Var[$var];
- else return -1;
- }
- function __unset($var) {
- unset($this->Var[$var]);
- }
- }
+ function __set($var, $val) {
+ $this->Var[$var] = $val;
+ }
+ function __get($var) {
+ if(isset($this->Var[$var])) return $this->Var[$var];
+ else return -1;
+ }
+ function __unset($var) {
+ unset($this->Var[$var]);
+ }
+ }
- $SomeObj = new TheObj;
+ $SomeObj = new TheObj;
- // this will fine
- $SomeObj->RealVar1 = 'somevalue';
- $SomeObj->{'RealVar2'} = 'othervalue';
- $SomeObj->{'RealVar'.(3)} = 'othervaluetoo';
- $SomeObj->{'RealVar'.'4'} = 'anothervalue';
+ // this will fine
+ $SomeObj->RealVar1 = 'somevalue';
+ $SomeObj->{'RealVar2'} = 'othervalue';
+ $SomeObj->{'RealVar'.(3)} = 'othervaluetoo';
+ $SomeObj->{'RealVar'.'4'} = 'anothervalue';
- // this will fine too
- $SomeObj->Virtual1 = 'somevalue';
- $SomeObj->{'Virtual2'} = 'othervalue';
+ // this will fine too
+ $SomeObj->Virtual1 = 'somevalue';
+ $SomeObj->{'Virtual2'} = 'othervalue';
- // it's can't be used since this will encounter error
- $SomeObj->{'Virtual'.(3)} = 'othervaluetoo';
- $SomeObj->{'Virtual'.'4'} = 'anothervalue';
+ // it's can't be used since this will encounter error
+ $SomeObj->{'Virtual'.(3)} = 'othervaluetoo';
+ $SomeObj->{'Virtual'.'4'} = 'anothervalue';
- // but this will fine, ofcourse
- $SomeObj->Var['Virtual'.(3)] = 'othervaluetoo';
- $SomeObj->Var['Virtual'.'4'] = 'anothervalue';
+ // but this will fine, ofcourse
+ $SomeObj->Var['Virtual'.(3)] = 'othervaluetoo';
+ $SomeObj->Var['Virtual'.'4'] = 'anothervalue';
- var_dump($SomeObj->RealVar1);
- print $SomeObj->{'RealVar'.(3)}."\n";
+ var_dump($SomeObj->RealVar1);
+ print $SomeObj->{'RealVar'.(3)}."\n";
- unset($SomeObj->RealVar1);
- unset($SomeObj->{'RealVar'.(3)});
+ unset($SomeObj->RealVar1);
+ unset($SomeObj->{'RealVar'.(3)});
- //the lines below will catch by '__get' magic method since these variables are unavailable anymore
- var_dump($SomeObj->RealVar1);
- print $SomeObj->{'RealVar'.(3)}."\n";
+ //the lines below will catch by '__get' magic method since these variables are unavailable anymore
+ var_dump($SomeObj->RealVar1);
+ print $SomeObj->{'RealVar'.(3)}."\n";
- // now we will try to unset these variables
- unset($SomeObj->Virtual1);
- unset($SomeObj->{'Virtual'.(3)});
+ // now we will try to unset these variables
+ unset($SomeObj->Virtual1);
+ unset($SomeObj->{'Virtual'.(3)});
- //but, these variables are still available??? even though they're "unset"-ed
- print $SomeObj->Virtual1."\n";
- print $SomeObj->{'Virtual'.(3)}."\n";
+ //but, these variables are still available??? even though they're "unset"-ed
+ print $SomeObj->Virtual1."\n";
+ print $SomeObj->{'Virtual'.(3)}."\n";
?>
--EXPECT--
string(9) "somevalue"
diff --git a/Zend/tests/bug33710.phpt b/Zend/tests/bug33710.phpt
index f65576074b..f731c39509 100644
--- a/Zend/tests/bug33710.phpt
+++ b/Zend/tests/bug33710.phpt
@@ -5,21 +5,21 @@ Bug #33710 (ArrayAccess objects doesn't initialize $this)
class Foo implements ArrayAccess
{
- function offsetExists($offset) {/*...*/}
- function offsetGet($offset) {/*...*/}
- function offsetSet($offset, $value) {/*...*/}
- function offsetUnset($offset) {/*...*/}
+ function offsetExists($offset) {/*...*/}
+ function offsetGet($offset) {/*...*/}
+ function offsetSet($offset, $value) {/*...*/}
+ function offsetUnset($offset) {/*...*/}
- function fail()
- {
- $this['blah'];
- }
+ function fail()
+ {
+ $this['blah'];
+ }
- function succeed()
- {
- $this;
- $this['blah'];
- }
+ function succeed()
+ {
+ $this;
+ $this['blah'];
+ }
}
$bar = new Foo();
diff --git a/Zend/tests/bug33771.phpt b/Zend/tests/bug33771.phpt
index 6eea49edbe..368a1662a8 100644
--- a/Zend/tests/bug33771.phpt
+++ b/Zend/tests/bug33771.phpt
@@ -20,13 +20,13 @@ function make_exception_and_change_err_reporting()
try {
- @make_exception();
+ @make_exception();
} catch (Exception $e) {}
var_dump(error_reporting());
try {
- @make_exception_and_change_err_reporting();
+ @make_exception_and_change_err_reporting();
} catch (Exception $e) {}
var_dump(error_reporting());
diff --git a/Zend/tests/bug33996.phpt b/Zend/tests/bug33996.phpt
index 3936eb8845..d5ec3386d6 100644
--- a/Zend/tests/bug33996.phpt
+++ b/Zend/tests/bug33996.phpt
@@ -20,14 +20,14 @@ function NormalTest($a)
}
try {
- NormalTest();
+ NormalTest();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- FooTest();
+ FooTest();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
FooTest(new Foo());
?>
diff --git a/Zend/tests/bug33999.phpt b/Zend/tests/bug33999.phpt
index 7460815441..2b03c3124a 100644
--- a/Zend/tests/bug33999.phpt
+++ b/Zend/tests/bug33999.phpt
@@ -23,8 +23,8 @@ object(Foo)#1 (1) {
string(3) "bat"
}
-Notice: Object of class Foo could not be converted to int in %sbug33999.php on line 9
+Warning: Object of class Foo could not be converted to int in %s on line %d
int(1)
-Notice: Object of class Foo could not be converted to float in %sbug33999.php on line 12
+Warning: Object of class Foo could not be converted to float in %s on line %d
float(1)
diff --git a/Zend/tests/bug34062.phpt b/Zend/tests/bug34062.phpt
index f1c0e477a9..456682753d 100644
--- a/Zend/tests/bug34062.phpt
+++ b/Zend/tests/bug34062.phpt
@@ -8,13 +8,13 @@ function f2() { echo "here\n"; }
try {
// Currently it's the minimum required number of zeros
// If you remove one, it won't crash
- max(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ max(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, f1());
} catch (Exception $e) {
- echo "(((\n";
- f2(0, 0, 0); // Won't crash if less than 3 zeros here
- echo ")))\n";
+ echo "(((\n";
+ f2(0, 0, 0); // Won't crash if less than 3 zeros here
+ echo ")))\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/bug34064.phpt b/Zend/tests/bug34064.phpt
index 83c6902803..3cdd709238 100644
--- a/Zend/tests/bug34064.phpt
+++ b/Zend/tests/bug34064.phpt
@@ -6,7 +6,7 @@ class XmlTest {
function test_ref(&$test)
{
- $test = "ok";
+ $test = "ok";
}
function test($test)
diff --git a/Zend/tests/bug34310.phpt b/Zend/tests/bug34310.phpt
index 1d2bb03ad3..2a5a36daea 100644
--- a/Zend/tests/bug34310.phpt
+++ b/Zend/tests/bug34310.phpt
@@ -5,7 +5,7 @@ Bug #34310 (foreach($arr as $c->d => $x) crashes)
class C
{
- public $d;
+ public $d;
}
$c = new C();
@@ -15,13 +15,13 @@ $arr = array (1 => 'a', 2 => 'b', 3 => 'c');
// Works fine:
foreach($arr as $x => $c->d)
{
- echo "{$x} => {$c->d}\n";
+ echo "{$x} => {$c->d}\n";
}
// Crashes:
foreach($arr as $c->d => $x)
{
- echo "{$c->d} => {$x}\n";
+ echo "{$c->d} => {$x}\n";
}
?>
diff --git a/Zend/tests/bug34467.phpt b/Zend/tests/bug34467.phpt
index fa1d8de2cd..e301291e3c 100644
--- a/Zend/tests/bug34467.phpt
+++ b/Zend/tests/bug34467.phpt
@@ -3,19 +3,19 @@ Bug #34467 (foreach + __get + __set incosistency)
--FILE--
<?php
class abc {
- private $arr;
+ private $arr;
- function __set ($key, $value) {
+ function __set ($key, $value) {
$this->arr[$key] = $value;
}
- function __get ($key) {
- return $this->arr[$key];
- }
+ function __get ($key) {
+ return $this->arr[$key];
+ }
}
$abc = new abc();
foreach (array (1,2,3) as $abc->k => $abc->v) {
- var_dump($abc->k,$abc->v);
+ var_dump($abc->k,$abc->v);
}
?>
--EXPECT--
diff --git a/Zend/tests/bug34678.phpt b/Zend/tests/bug34678.phpt
index 2a13201f26..86db44357e 100644
--- a/Zend/tests/bug34678.phpt
+++ b/Zend/tests/bug34678.phpt
@@ -3,22 +3,22 @@ Bug #34678 (__call(), is_callable() and static methods)
--FILE--
<?php
class A {
- public function __call($m, $a) {
- echo "__call\n";
- }
+ public function __call($m, $a) {
+ echo "__call\n";
+ }
}
class B extends A {
- public static function foo() {
- echo "foo\n";
- }
+ public static function foo() {
+ echo "foo\n";
+ }
}
if (is_callable(array('B', 'foo'))) {
- call_user_func(array('B', 'foo'));
+ call_user_func(array('B', 'foo'));
}
if (is_callable(array('A', 'foo'))) {
- call_user_func(array('A', 'foo'));
+ call_user_func(array('A', 'foo'));
}
?>
--EXPECT--
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/bug34873.phpt b/Zend/tests/bug34873.phpt
index da11276458..fd31842d59 100644
--- a/Zend/tests/bug34873.phpt
+++ b/Zend/tests/bug34873.phpt
@@ -3,19 +3,19 @@ Bug #34873 (Segmentation Fault on foreach in object)
--FILE--
<?php
class pwa {
- public $var;
+ public $var;
- function __construct(){
- $this->var = array();
- }
+ function __construct(){
+ $this->var = array();
+ }
- function test (){
- $cont = array();
- $cont["mykey"] = "myvalue";
+ function test (){
+ $cont = array();
+ $cont["mykey"] = "myvalue";
- foreach ($cont as $this->var['key'] => $this->var['value'])
- var_dump($this->var['value']);
- }
+ foreach ($cont as $this->var['key'] => $this->var['value'])
+ var_dump($this->var['value']);
+ }
}
$myPwa = new Pwa();
$myPwa->test();
diff --git a/Zend/tests/bug34893.phpt b/Zend/tests/bug34893.phpt
index bbe02358e9..c821875a99 100644
--- a/Zend/tests/bug34893.phpt
+++ b/Zend/tests/bug34893.phpt
@@ -3,22 +3,22 @@ Bug #34893 (PHP5.1 overloading, Cannot access private property)
--FILE--
<?php
class A {
- private $p;
- function __get($name){
- return $this->$name;
- }
- function __set($name, $value) {
- $this->$name = $value;
- }
+ private $p;
+ function __get($name){
+ return $this->$name;
+ }
+ function __set($name, $value) {
+ $this->$name = $value;
+ }
}
class B {
- private $t;
- function __get($name){
- return $this->$name;
- }
- function __set($name, $value) {
- $this->$name = $value;
- }
+ private $t;
+ function __get($name){
+ return $this->$name;
+ }
+ function __set($name, $value) {
+ $this->$name = $value;
+ }
}
$a = new A;
$b = new B;
diff --git a/Zend/tests/bug35017.phpt b/Zend/tests/bug35017.phpt
index 9944df55e0..0b9e9a95e2 100644
--- a/Zend/tests/bug35017.phpt
+++ b/Zend/tests/bug35017.phpt
@@ -4,17 +4,17 @@ Bug #35017 (Exception thrown in error handler may cause unexpected behavior)
<?php
set_error_handler('errorHandler');
try {
- if ($a) {
- echo "1\n";
- } else {
- echo "0\n";
- }
- echo "?\n";
+ if ($a) {
+ echo "1\n";
+ } else {
+ echo "0\n";
+ }
+ echo "?\n";
} catch(Exception $e) {
echo "This Exception should be caught\n";
}
-function errorHandler($errno, $errstr, $errfile, $errline, $vars) {
- throw new Exception('Some Exception');
+function errorHandler($errno, $errstr, $errfile, $errline) {
+ throw new Exception('Some Exception');
}
?>
--EXPECT--
diff --git a/Zend/tests/bug35163_2.phpt b/Zend/tests/bug35163_2.phpt
index 01387204c8..81bf853266 100644
--- a/Zend/tests/bug35163_2.phpt
+++ b/Zend/tests/bug35163_2.phpt
@@ -16,21 +16,7 @@ array(3) {
[0]=>
int(2)
[1]=>
- &array(3) {
- [0]=>
- int(2)
- [1]=>
- *RECURSION*
- [2]=>
- *RECURSION*
- }
+ *RECURSION*
[2]=>
- &array(3) {
- [0]=>
- int(2)
- [1]=>
- *RECURSION*
- [2]=>
- *RECURSION*
- }
+ *RECURSION*
}
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/bug36006.phpt b/Zend/tests/bug36006.phpt
index 79f9897d13..f86c4b5a29 100644
--- a/Zend/tests/bug36006.phpt
+++ b/Zend/tests/bug36006.phpt
@@ -4,22 +4,22 @@ Bug #36006 (Problem with $this in __destruct())
<?php
class Person {
- public $dad;
- public function __destruct() {
- $this->dad = null; /* no segfault if this is commented out */
- }
+ public $dad;
+ public function __destruct() {
+ $this->dad = null; /* no segfault if this is commented out */
+ }
}
class Dad extends Person {
- public $son;
- public function __construct() {
- $this->son = new Person;
- $this->son->dad = $this; /* no segfault if this is commented out */
- }
- public function __destruct() {
- $this->son = null;
- parent::__destruct(); /* segfault here */
- }
+ public $son;
+ public function __construct() {
+ $this->son = new Person;
+ $this->son->dad = $this; /* no segfault if this is commented out */
+ }
+ public function __destruct() {
+ $this->son = null;
+ parent::__destruct(); /* segfault here */
+ }
}
$o = new Dad;
diff --git a/Zend/tests/bug36268.phpt b/Zend/tests/bug36268.phpt
index 8c93186c73..e95b91cc3e 100644
--- a/Zend/tests/bug36268.phpt
+++ b/Zend/tests/bug36268.phpt
@@ -3,9 +3,9 @@ Bug #36268 (Object destructors called even after fatal errors)
--FILE--
<?php
class Foo {
- function __destruct() {
- echo "Ha!\n";
- }
+ function __destruct() {
+ echo "Ha!\n";
+ }
}
$x = new Foo();
bar();
@@ -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..67dfa987da 100644
--- a/Zend/tests/bug37138.phpt
+++ b/Zend/tests/bug37138.phpt
@@ -1,14 +1,14 @@
--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); });
class st {
- public static function e () {echo ("EHLO\n");}
- public static function e2 () {call_user_func (array ('self', 'e'));}
+ public static function e () {echo ("EHLO\n");}
+ public static function e2 () {call_user_func (array ('self', 'e'));}
}
class stch extends st {
- public static function g () {call_user_func (array ('parent', 'e'));}
+ public static function g () {call_user_func (array ('parent', 'e'));}
}
st::e ();
st::e2 ();
diff --git a/Zend/tests/bug37212.phpt b/Zend/tests/bug37212.phpt
index 212ef23ec7..0d19efa8f1 100644
--- a/Zend/tests/bug37212.phpt
+++ b/Zend/tests/bug37212.phpt
@@ -38,7 +38,6 @@ $B->copyValue($C);
var_dump($B);
?>
-===DONE===
--EXPECTF--
object(B)#%d (1) {
["value":protected]=>
@@ -52,4 +51,3 @@ object(B)#%d (1) {
["value":protected]=>
string(1) "C"
}
-===DONE===
diff --git a/Zend/tests/bug37251.phpt b/Zend/tests/bug37251.phpt
index 0e5ac8fd48..46f00ba770 100644
--- a/Zend/tests/bug37251.phpt
+++ b/Zend/tests/bug37251.phpt
@@ -3,15 +3,16 @@ Bug #37251 (deadlock when custom error handler is to catch array type hint error
--FILE--
<?php
class Foo {
- function bar(array $foo) {
- }
+ function bar(array $foo) {
+ }
}
try {
- $foo = new Foo();
- $foo->bar();
+ $foo = new Foo();
+ $foo->bar();
} catch (Error $e) {
- echo 'OK';
+ echo 'OK';
}
+?>
--EXPECT--
OK
diff --git a/Zend/tests/bug37632.phpt b/Zend/tests/bug37632.phpt
index a5a782508c..13ffa62128 100644
--- a/Zend/tests/bug37632.phpt
+++ b/Zend/tests/bug37632.phpt
@@ -5,27 +5,27 @@ Bug #37632 (Protected method access problem)
class A1
{
- protected function test()
- {
- echo __METHOD__ . "\n";
- }
+ protected function test()
+ {
+ echo __METHOD__ . "\n";
+ }
}
class B1 extends A1
{
- public function doTest(A1 $obj)
- {
- echo __METHOD__ . "\n";
- $obj->test();
- }
+ public function doTest(A1 $obj)
+ {
+ echo __METHOD__ . "\n";
+ $obj->test();
+ }
}
class C1 extends A1
{
- protected function test()
- {
- echo __METHOD__ . "\n";
- }
+ protected function test()
+ {
+ echo __METHOD__ . "\n";
+ }
}
$b = new B1;
@@ -33,27 +33,27 @@ $b->doTest(new C1);
class A2
{
- static protected function test()
- {
- echo __METHOD__ . "\n";
- }
+ static protected function test()
+ {
+ echo __METHOD__ . "\n";
+ }
}
class B2 extends A2
{
- static public function doTest(A2 $obj)
- {
- echo __METHOD__ . "\n";
- $obj->test();
- }
+ static public function doTest(A2 $obj)
+ {
+ echo __METHOD__ . "\n";
+ $obj->test();
+ }
}
class C2 extends A2
{
- static protected function test()
- {
- echo __METHOD__ . "\n";
- }
+ static protected function test()
+ {
+ echo __METHOD__ . "\n";
+ }
}
B2::doTest(new C2);
@@ -64,32 +64,32 @@ B2::doTest(new C2);
interface Ctor
{
- function __construct($x);
+ function __construct($x);
}
class A3 implements Ctor
{
- protected function __construct()
- {
- echo __METHOD__ . "\n";
- }
+ protected function __construct()
+ {
+ echo __METHOD__ . "\n";
+ }
}
class B3 extends A3
{
- static public function doTest()
- {
- echo __METHOD__ . "\n";
- new C3;
- }
+ static public function doTest()
+ {
+ echo __METHOD__ . "\n";
+ new C3;
+ }
}
class C3 extends A3
{
- protected function __construct()
- {
- echo __METHOD__ . "\n";
- }
+ protected function __construct()
+ {
+ echo __METHOD__ . "\n";
+ }
}
B3::doTest();
@@ -98,27 +98,27 @@ B3::doTest();
class A4
{
- protected function __construct()
- {
- echo __METHOD__ . "\n";
- }
+ protected function __construct()
+ {
+ echo __METHOD__ . "\n";
+ }
}
class B4 extends A4
{
- static public function doTest()
- {
- echo __METHOD__ . "\n";
- new C4;
- }
+ static public function doTest()
+ {
+ echo __METHOD__ . "\n";
+ new C4;
+ }
}
class C4 extends A4
{
- protected function __construct()
- {
- echo __METHOD__ . "\n";
- }
+ protected function __construct()
+ {
+ echo __METHOD__ . "\n";
+ }
}
B4::doTest();
@@ -132,7 +132,7 @@ B2::doTest
C2::test
B4::doTest
-Fatal error: Uncaught Error: Call to protected C4::__construct() from context 'B4' in %sbug37632.php:%d
+Fatal error: Uncaught Error: Call to protected C4::__construct() from scope B4 in %s:%d
Stack trace:
#0 %s(%d): B4::doTest()
#1 {main}
diff --git a/Zend/tests/bug37667.phpt b/Zend/tests/bug37667.phpt
index ecf43c5b80..1b278cab65 100644
--- a/Zend/tests/bug37667.phpt
+++ b/Zend/tests/bug37667.phpt
@@ -5,12 +5,12 @@ Bug #37667 (Object is not added into array returned by __get)
class Test
{
- protected $property = array('foo' => 'bar');
+ protected $property = array('foo' => 'bar');
- function __get($name)
- {
- return $this->property;
- }
+ function __get($name)
+ {
+ return $this->property;
+ }
}
$obj = new Test;
@@ -26,11 +26,10 @@ $obj->property[] = 2;
var_dump($obj);
?>
-===DONE===
--EXPECTF--
string(3) "bar"
-Notice: Undefined offset: 2 in %sbug37667.php on line 16
+Warning: Undefined array key 2 in %s on line %d
NULL
object(Test)#%d (1) {
["property":protected]=>
@@ -50,4 +49,3 @@ object(Test)#%d (1) {
string(3) "bar"
}
}
-===DONE===
diff --git a/Zend/tests/bug37707.phpt b/Zend/tests/bug37707.phpt
index ac2dfb8777..6781804aa5 100644
--- a/Zend/tests/bug37707.phpt
+++ b/Zend/tests/bug37707.phpt
@@ -3,9 +3,9 @@ Bug #37707 (clone without assigning leaks memory)
--FILE--
<?php
class testme {
- function __clone() {
- echo "clonned\n";
- }
+ function __clone() {
+ echo "clonned\n";
+ }
}
clone new testme();
echo "NO LEAK\n";
diff --git a/Zend/tests/bug37715.phpt b/Zend/tests/bug37715.phpt
index a585c78e5b..764dc1f5f1 100644
--- a/Zend/tests/bug37715.phpt
+++ b/Zend/tests/bug37715.phpt
@@ -24,6 +24,7 @@ foreach($a as $k => $d)
}
// Alternatively $c = $a; and foreachloop removal will cause identical results.
var_dump(key($a['b']));
+?>
--EXPECT--
int(3)
int(3)
diff --git a/Zend/tests/bug37811.phpt b/Zend/tests/bug37811.phpt
index 96645d0354..3e433a0da6 100644
--- a/Zend/tests/bug37811.phpt
+++ b/Zend/tests/bug37811.phpt
@@ -5,24 +5,29 @@ Bug #37811 (define not using toString on objects)
class TestClass
{
- function __toString()
- {
- return "Foo";
- }
+ function __toString()
+ {
+ return "Foo";
+ }
}
-define("Bar",new TestClass);
+define("Bar", new TestClass);
var_dump(Bar);
-define("Baz",new stdClass);
-var_dump(Baz);
-?>
-===DONE===
---EXPECTF--
-string(3) "Foo"
+try {
+ define("Baz", new stdClass);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
-Warning: Constants may only evaluate to scalar values, arrays or resources in %sbug37811.php on line %d
+try {
+ var_dump(Baz);
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
-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===
+?>
+--EXPECT--
+string(3) "Foo"
+define(): Argument #2 ($value) cannot be an object, stdClass given
+Undefined constant "Baz"
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/bug38220.phpt b/Zend/tests/bug38220.phpt
index bee3ffc75d..2700299a10 100644
--- a/Zend/tests/bug38220.phpt
+++ b/Zend/tests/bug38220.phpt
@@ -3,53 +3,53 @@ Bug #38220 (Crash on some object operations)
--FILE--
<?php
class drv {
- public $obj;
+ public $obj;
- function func1() {
- echo "func1(): {$this->obj->i}\n";
- }
+ function func1() {
+ echo "func1(): {$this->obj->i}\n";
+ }
- function close() {
- echo "close(): {$this->obj->i}\n";
- }
+ function close() {
+ echo "close(): {$this->obj->i}\n";
+ }
}
class A {
- public $i;
+ public $i;
- function __construct($i) {
- $this->i = $i;
+ function __construct($i) {
+ $this->i = $i;
- }
+ }
- function __call($method, $args) {
- $drv = myserv::drv();
+ function __call($method, $args) {
+ $drv = myserv::drv();
- $drv->obj = $this;
+ $drv->obj = $this;
- echo "before call $method\n";
- print_r($this);
- call_user_func_array(array($drv, $method), $args);
- echo "after call $method\n";
+ echo "before call $method\n";
+ print_r($this);
+ call_user_func_array(array($drv, $method), $args);
+ echo "after call $method\n";
- // Uncomment this line to work without crash
+ // Uncomment this line to work without crash
// $drv->obj = null;
- }
+ }
- function __destruct() {
- echo "A::__destruct()\n";
- $this->close();
- }
+ function __destruct() {
+ echo "A::__destruct()\n";
+ $this->close();
+ }
}
class myserv {
- private static $drv = null;
+ private static $drv = null;
- static function drv() {
- if (is_null(self::$drv))
- self::$drv = new drv;
- return self::$drv;
- }
+ static function drv() {
+ if (is_null(self::$drv))
+ self::$drv = new drv;
+ return self::$drv;
+ }
}
$obj1 = new A(1);
diff --git a/Zend/tests/bug38234.phpt b/Zend/tests/bug38234.phpt
index a81a3aadcc..413ebf721f 100644
--- a/Zend/tests/bug38234.phpt
+++ b/Zend/tests/bug38234.phpt
@@ -3,13 +3,13 @@ Bug #38234 (Exception in __clone makes memory leak)
--FILE--
<?php
class Foo {
- function __clone() {
- throw new Exception();
- }
+ function __clone() {
+ throw new Exception();
+ }
}
try {
- $x = new Foo();
- $y = clone $x;
+ $x = new Foo();
+ $y = clone $x;
} catch (Exception $e) {
}
echo "ok\n";
diff --git a/Zend/tests/bug38469.phpt b/Zend/tests/bug38469.phpt
index 6afcaf5fd3..b211dd76e9 100644
--- a/Zend/tests/bug38469.phpt
+++ b/Zend/tests/bug38469.phpt
@@ -10,12 +10,12 @@ $b[0][0] = $b;
var_dump($b);
function f() {
- $a = array();
- $a[0] = $a;
- var_dump($a);
- $b = array(array());
- $b[0][0] = $b;
- var_dump($b);
+ $a = array();
+ $a[0] = $a;
+ var_dump($a);
+ $b = array(array());
+ $b[0][0] = $b;
+ var_dump($b);
}
f();
?>
diff --git a/Zend/tests/bug38623.phpt b/Zend/tests/bug38623.phpt
index 9b042a9141..873cdf42d4 100644
--- a/Zend/tests/bug38623.phpt
+++ b/Zend/tests/bug38623.phpt
@@ -3,11 +3,11 @@ Bug #38623 (leaks in a tricky code with switch() and exceptions)
--FILE--
<?php
try {
- switch(strtolower("apache")) {
- case "apache":
- throw new Exception("test");
- break;
- }
+ switch(strtolower("apache")) {
+ case "apache":
+ throw new Exception("test");
+ break;
+ }
} catch (Exception $e) {
echo "ok\n";
}
diff --git a/Zend/tests/bug38772.phpt b/Zend/tests/bug38772.phpt
index 0be6457d72..9633f2a692 100644
--- a/Zend/tests/bug38772.phpt
+++ b/Zend/tests/bug38772.phpt
@@ -4,25 +4,25 @@ Bug #38772 (inconsistent overriding of methods in different visibility contexts)
<?php
class A {
- public function __construct() {
- $this -> foo();
- }
+ public function __construct() {
+ $this -> foo();
+ }
- private function foo() {
- echo __METHOD__ . "\r\n";
- }
+ private function foo() {
+ echo __METHOD__ . "\r\n";
+ }
}
class B extends A {
- public function foo() {
- echo __METHOD__ . "\r\n";
- }
+ public function foo() {
+ echo __METHOD__ . "\r\n";
+ }
}
class C extends A {
- protected function foo() {
- echo __METHOD__ . "\r\n";
- }
+ protected function foo() {
+ echo __METHOD__ . "\r\n";
+ }
}
class D extends A {
@@ -35,6 +35,7 @@ $a = new A();
$b = new B();
$c = new C();
$d = new D();
+?>
--EXPECT--
A::foo
A::foo
diff --git a/Zend/tests/bug38779.phpt b/Zend/tests/bug38779.phpt
index d552f8e20d..7260a709d0 100644
--- a/Zend/tests/bug38779.phpt
+++ b/Zend/tests/bug38779.phpt
@@ -4,27 +4,27 @@ Bug #38779 (engine crashes when require()'ing file with syntax error through use
<?php
class Loader {
- private $position;
- private $data;
- public function stream_open($path, $mode, $options, &$opened_path) {
- $this->data = '<' . "?php \n\"\";ll l\n ?" . '>';
- $this->position = 0;
- return true;
- }
- function stream_read($count) {
- $ret = substr($this->data, $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
- function stream_eof() {
- return $this->position >= strlen($this->data);
- }
- function stream_stat() {
- return array('size' => strlen($this->data));
- }
- function stream_set_option($option, $arg1, $arg2) {
- return false;
- }
+ private $position;
+ private $data;
+ public function stream_open($path, $mode, $options, &$opened_path) {
+ $this->data = '<' . "?php \n\"\";ll l\n ?" . '>';
+ $this->position = 0;
+ return true;
+ }
+ function stream_read($count) {
+ $ret = substr($this->data, $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+ function stream_eof() {
+ return $this->position >= strlen($this->data);
+ }
+ function stream_stat() {
+ return array('size' => strlen($this->data));
+ }
+ function stream_set_option($option, $arg1, $arg2) {
+ return false;
+ }
}
stream_wrapper_register('Loader', 'Loader');
require 'Loader://qqq.php';
diff --git a/Zend/tests/bug38779_1.phpt b/Zend/tests/bug38779_1.phpt
index f4f89235a4..084463116a 100644
--- a/Zend/tests/bug38779_1.phpt
+++ b/Zend/tests/bug38779_1.phpt
@@ -4,28 +4,28 @@ Bug #38779 (engine crashes when require()'ing file with syntax error through use
<?php
class Loader {
- private $position;
- private $data;
- public function stream_open($path, $mode, $options, &$opened_path) {
- $this->data = '<' . "?php \n\"\";ll l\n ?" . '>';
- $this->position = 0;
- return true;
- }
- function stream_read($count) {
- $ret = substr($this->data, $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
- function stream_eof() {
- return $this->position >= strlen($this->data);
- }
- function stream_flush() {
- var_dump("flush!");
- }
- function stream_close() {
- @unlink(__DIR__."/bug38779.txt");
- var_dump("close!");
- }
+ private $position;
+ private $data;
+ public function stream_open($path, $mode, $options, &$opened_path) {
+ $this->data = '<' . "?php \n\"\";ll l\n ?" . '>';
+ $this->position = 0;
+ return true;
+ }
+ function stream_read($count) {
+ $ret = substr($this->data, $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+ function stream_eof() {
+ return $this->position >= strlen($this->data);
+ }
+ function stream_flush() {
+ var_dump("flush!");
+ }
+ function stream_close() {
+ @unlink(__DIR__."/bug38779.txt");
+ var_dump("close!");
+ }
}
stream_wrapper_register('Loader', 'Loader');
$fp = fopen ('Loader://qqq.php', 'r');
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..5f7c784976 100644
--- a/Zend/tests/bug39003.phpt
+++ b/Zend/tests/bug39003.phpt
@@ -1,11 +1,11 @@
--TEST--
-Bug #39003 (__autoload() is called for type hinting)
+Bug #39003 (autoloader is called for type hinting)
--FILE--
<?php
class ClassName
{
- public $var = 'bla';
+ public $var = 'bla';
}
function test (OtherClassName $object) { }
@@ -20,7 +20,7 @@ test($obj);
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to test() must be an instance of OtherClassName, instance of ClassName given, called in %s on line %d and defined in %s:%d
+Fatal error: Uncaught TypeError: test(): Argument #1 ($object) must be of type OtherClassName, ClassName given, called in %s:%d
Stack trace:
#0 %s(%d): test(Object(ClassName))
#1 {main}
diff --git a/Zend/tests/bug39018.phpt b/Zend/tests/bug39018.phpt
index a00e1fb819..1e7cced175 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 %d 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/bug39018_2.phpt b/Zend/tests/bug39018_2.phpt
index 81831d51e0..5d45f0700b 100644
--- a/Zend/tests/bug39018_2.phpt
+++ b/Zend/tests/bug39018_2.phpt
@@ -8,11 +8,8 @@ error_reporting(E_ALL);
$foo = 'test';
$x = @$foo[6];
-print @($foo[100] + $foo[130]);
-
-print "\nDone\n";
+var_dump(@($foo[100] . $foo[130]));
?>
--EXPECT--
-0
-Done
+string(0) ""
diff --git a/Zend/tests/bug39036.phpt b/Zend/tests/bug39036.phpt
index 419810eaa1..669ca9255e 100644
--- a/Zend/tests/bug39036.phpt
+++ b/Zend/tests/bug39036.phpt
@@ -6,7 +6,7 @@ Bug #39036 (Unsetting key of foreach() yields segmentation fault)
$key = 'asdf';
foreach (get_defined_vars() as $key => $value) {
- unset($$key);
+ unset($$key);
}
var_dump($key);
@@ -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/bug39297.phpt b/Zend/tests/bug39297.phpt
index 36c0af7dbb..6ea989da46 100644
--- a/Zend/tests/bug39297.phpt
+++ b/Zend/tests/bug39297.phpt
@@ -17,14 +17,14 @@ class MyTree implements ArrayAccess {
}
public function offsetSet($offset, $value) {
- echo "offsetSet()\n";
+ echo "offsetSet()\n";
$cannonicalName = strtolower($offset);
$this->children[$cannonicalName] = $value;
$value->parent = $this;
}
public function offsetGet($offset) {
- echo "offsetGet()\n";
+ echo "offsetGet()\n";
$cannonicalName = strtolower($offset);
return $this->children[$cannonicalName];
}
diff --git a/Zend/tests/bug39304.phpt b/Zend/tests/bug39304.phpt
index 4394cae1d4..a5422d2f4f 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/bug39346.phpt b/Zend/tests/bug39346.phpt
index bde88edb9d..6e47ca037d 100644
--- a/Zend/tests/bug39346.phpt
+++ b/Zend/tests/bug39346.phpt
@@ -4,17 +4,17 @@ Bug #39346 (Unsetting a static variable inside a destructor causes segfault late
<?php
class test
{
- protected $_id;
- static $instances;
+ protected $_id;
+ static $instances;
- public function __construct($id) {
- $this->_id = $id;
- self::$instances[$this->_id] = $this;
- }
+ public function __construct($id) {
+ $this->_id = $id;
+ self::$instances[$this->_id] = $this;
+ }
- function __destruct() {
- unset(self::$instances[$this->_id]);
- }
+ function __destruct() {
+ unset(self::$instances[$this->_id]);
+ }
}
$test = new test(2);
$test = new test(1);
diff --git a/Zend/tests/bug39438.phpt b/Zend/tests/bug39438.phpt
index d10e6d9ab7..5336d3ad81 100644
--- a/Zend/tests/bug39438.phpt
+++ b/Zend/tests/bug39438.phpt
@@ -7,36 +7,36 @@ memory_limit=16M
$i=0;
$test2=array(
'a1_teasermenu' => array(
- 'downloadcounter' => 2777,
+ 'downloadcounter' => 2777,
'versions' => array(
- '0.1.0' => array (
- 'title' => 'A1 Teasermenu',
- 'description' => 'Displays a teaser for advanced subpages or a selection of advanced pages',
- 'state' => 'stable',
- 'reviewstate' => 0,
- 'category' => 'plugin',
- 'downloadcounter' => 2787,
- 'lastuploaddate' => 1088427240,
- 'dependencies' => array (
- 'depends' => array(
- 'typo3' =>'',
- 'php' =>'',
- 'cms' => ''
- ),
- 'conflicts' => array('' =>'')
- ),
- 'authorname' => 'Mirko Balluff',
- 'authoremail' => 'balluff@amt1.de',
- 'ownerusername' => 'amt1',
- 't3xfilemd5' => '3a4ec198b6ea8d0bc2d69d9b7400398f',
- )
- )
- )
+ '0.1.0' => array (
+ 'title' => 'A1 Teasermenu',
+ 'description' => 'Displays a teaser for advanced subpages or a selection of advanced pages',
+ 'state' => 'stable',
+ 'reviewstate' => 0,
+ 'category' => 'plugin',
+ 'downloadcounter' => 2787,
+ 'lastuploaddate' => 1088427240,
+ 'dependencies' => array (
+ 'depends' => array(
+ 'typo3' =>'',
+ 'php' =>'',
+ 'cms' => ''
+ ),
+ 'conflicts' => array('' =>'')
+ ),
+ 'authorname' => 'Mirko Balluff',
+ 'authoremail' => 'balluff@amt1.de',
+ 'ownerusername' => 'amt1',
+ 't3xfilemd5' => '3a4ec198b6ea8d0bc2d69d9b7400398f',
+ )
+ )
+ )
);
$test=array();
while($i<1200) {
- $test[]=$test2;
- $i++;
+ $test[]=$test2;
+ $i++;
}
$out=serialize($test);
echo "ok\n";
diff --git a/Zend/tests/bug39445.phpt b/Zend/tests/bug39445.phpt
index cf1607f2dd..d86b2ce19e 100644
--- a/Zend/tests/bug39445.phpt
+++ b/Zend/tests/bug39445.phpt
@@ -3,14 +3,14 @@ Bug #39445 (Calling debug_backtrace() in the __toString() function produces a cr
--FILE--
<?php
class test {
- public function __toString() {
- debug_backtrace();
- return 'lowercase';
- }
+ public function __toString() {
+ debug_backtrace();
+ return 'lowercase';
+ }
}
- $test = new test();
- echo strtoupper($test);
+ $test = new test();
+ echo strtoupper($test);
?>
--EXPECT--
LOWERCASE
diff --git a/Zend/tests/bug39542.phpt b/Zend/tests/bug39542.phpt
index 336deb7f18..79c1c56e91 100644
--- a/Zend/tests/bug39542.phpt
+++ b/Zend/tests/bug39542.phpt
@@ -5,9 +5,9 @@ Bug #39542 (Behaviour of require_once/include_once different to < 5.2.0)
$oldcwd = getcwd();
chdir(__DIR__);
if (substr(PHP_OS, 0, 3) == 'WIN') {
- set_include_path(__DIR__.'/bug39542;.');
+ set_include_path(__DIR__.'/bug39542;.');
} else {
- set_include_path(__DIR__.'/bug39542:.');
+ set_include_path(__DIR__.'/bug39542:.');
}
spl_autoload_register(function ($class) {
diff --git a/Zend/tests/bug39542/bug39542.inc b/Zend/tests/bug39542/bug39542.inc
index 13b3b3eaf4..c0dcada750 100644
--- a/Zend/tests/bug39542/bug39542.inc
+++ b/Zend/tests/bug39542/bug39542.inc
@@ -1,7 +1,7 @@
<?php
class bug39542 {
- function __construct() {
- echo "ok\n";
- }
+ function __construct() {
+ echo "ok\n";
+ }
}
?>
diff --git a/Zend/tests/bug39721.phpt b/Zend/tests/bug39721.phpt
index aa0df793ff..e25cfe8820 100644
--- a/Zend/tests/bug39721.phpt
+++ b/Zend/tests/bug39721.phpt
@@ -3,21 +3,21 @@ Bug #39721 (Runtime inheritance causes data corruption)
--FILE--
<?php
class test2 {
- private static $instances = 0;
- public $instance;
+ private static $instances = 0;
+ public $instance;
- public function __construct() {
- $this->instance = ++self::$instances;
- }
+ public function __construct() {
+ $this->instance = ++self::$instances;
+ }
}
$foo = new test2();
if (is_object($foo)) {
- class test2_child extends test2 {
+ class test2_child extends test2 {
- }
+ }
}
$child = new test2_child();
diff --git a/Zend/tests/bug39775.phpt b/Zend/tests/bug39775.phpt
index 4c6ce6baf1..ed6d66a9cc 100644
--- a/Zend/tests/bug39775.phpt
+++ b/Zend/tests/bug39775.phpt
@@ -3,11 +3,11 @@ Bug #39775 ("Indirect modification ..." message is not shown)
--FILE--
<?php
class test {
- var $array = array();
- function __get($var) {
- $v =& $this->array;
- return $this->array;
- }
+ var $array = array();
+ function __get($var) {
+ $v =& $this->array;
+ return $this->array;
+ }
}
$t = new test;
$t->anything[] = 'bar';
diff --git a/Zend/tests/bug39825.phpt b/Zend/tests/bug39825.phpt
index a241e0de36..305ed895d5 100644
--- a/Zend/tests/bug39825.phpt
+++ b/Zend/tests/bug39825.phpt
@@ -5,7 +5,7 @@ Bug #39825 (foreach produces memory error)
$array = array(1 => 2, "foo" => "bar");
$obj = (object)$array;
foreach ($obj as $name => $value) {
- echo "$name -> $value\n";
+ echo "$name -> $value\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/bug39944.phpt b/Zend/tests/bug39944.phpt
index d602a45b88..f68b656504 100644
--- a/Zend/tests/bug39944.phpt
+++ b/Zend/tests/bug39944.phpt
@@ -26,12 +26,12 @@ echo "intTheValue = {$intTheValue}\n";
$arrTheArray = array();
function &getArray() {
- global $arrTheArray;
- return $arrTheArray;
+ global $arrTheArray;
+ return $arrTheArray;
}
function addToArray(&$arr, $strToAdd) {
- $arr[] = $strToAdd;
+ $arr[] = $strToAdd;
}
addToArray(getArray(), "xx1");
@@ -47,21 +47,21 @@ echo "arrTheArray = " . print_r($arrTheArray, 1);
/****/
class RefTest {
- protected $arr;
+ protected $arr;
- function Add($strToAdd) {
- $this->addToArray($this->getArray(), $strToAdd);
- }
+ function Add($strToAdd) {
+ $this->addToArray($this->getArray(), $strToAdd);
+ }
- function &getArray() {
- if (!$this->arr)
- $this->arr = array();
- return $this->arr;
- }
+ function &getArray() {
+ if (!$this->arr)
+ $this->arr = array();
+ return $this->arr;
+ }
- private function addToArray(&$arr, $strToAdd) {
- $arr[] = $strToAdd;
- }
+ private function addToArray(&$arr, $strToAdd) {
+ $arr[] = $strToAdd;
+ }
}
$objRefTest = new RefTest();
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/bug40509.phpt b/Zend/tests/bug40509.phpt
index 5b7dfa09c8..7436934583 100644
--- a/Zend/tests/bug40509.phpt
+++ b/Zend/tests/bug40509.phpt
@@ -4,10 +4,10 @@ Bug #40509 (key() function changed behaviour if global array is used within func
<?php
function foo()
{
- global $arr;
+ global $arr;
- $c = $arr["v"];
- foreach ($c as $v) {}
+ $c = $arr["v"];
+ foreach ($c as $v) {}
}
$arr["v"] = array("a");
@@ -16,9 +16,10 @@ var_dump(key($arr["v"]));
foo();
var_dump(key($arr["v"]));
foreach ($arr["v"] as $k => $v) {
- var_dump($k);
+ var_dump($k);
}
var_dump(key($arr["v"]));
+?>
--EXPECT--
int(0)
int(0)
diff --git a/Zend/tests/bug40621.phpt b/Zend/tests/bug40621.phpt
index b56a28e58b..4025958060 100644
--- a/Zend/tests/bug40621.phpt
+++ b/Zend/tests/bug40621.phpt
@@ -4,10 +4,10 @@ Bug #40621 (Crash when constructor called inappropriately (statically))
<?php
class Foo {
- private function __construct() { }
- function get() {
- self::__construct();
- }
+ private function __construct() { }
+ function get() {
+ self::__construct();
+ }
}
Foo::get();
@@ -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/bug40705.phpt b/Zend/tests/bug40705.phpt
index 8a679654d5..959fac10f4 100644
--- a/Zend/tests/bug40705.phpt
+++ b/Zend/tests/bug40705.phpt
@@ -14,9 +14,10 @@ var_dump(key($foo));
doForeach($foo);
var_dump(key($foo));
foreach ($foo as $k => $v) {
- var_dump($k);
+ var_dump($k);
}
var_dump(key($foo));
+?>
--EXPECT--
int(0)
int(0)
diff --git a/Zend/tests/bug40770.phpt b/Zend/tests/bug40770.phpt
index c4c78c2220..f37d96d5ff 100644
--- a/Zend/tests/bug40770.phpt
+++ b/Zend/tests/bug40770.phpt
@@ -6,7 +6,7 @@ memory_limit=8M
<?php
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
if ($zend_mm_enabled === "0") {
- die("skip Zend MM disabled");
+ die("skip Zend MM disabled");
}
?>
--FILE--
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/bug40815.phpt b/Zend/tests/bug40815.phpt
index 3386097523..542a820f52 100644
--- a/Zend/tests/bug40815.phpt
+++ b/Zend/tests/bug40815.phpt
@@ -4,9 +4,9 @@ Bug #40815 (using strings like "class::func" and static methods in set_exception
<?php
class ehandle{
- static public function exh ($ex) {
- echo 'foo';
- }
+ static public function exh ($ex) {
+ echo 'foo';
+ }
}
set_exception_handler("ehandle::exh");
diff --git a/Zend/tests/bug40833.phpt b/Zend/tests/bug40833.phpt
index 625103a6c0..6a050eed8b 100644
--- a/Zend/tests/bug40833.phpt
+++ b/Zend/tests/bug40833.phpt
@@ -2,71 +2,71 @@
Bug #40833 (Crash when using unset() on an ArrayAccess object retrieved via __get)
--FILE--
<?php
- class entity
- {
- private $data;
- private $modified;
+ class entity
+ {
+ private $data;
+ private $modified;
- function __get($name)
- {
- if ( isset($this->data[$name]) )
- return $this->data[$name];
- else
- return $this->data[$name] = new set($this);
- }
+ function __get($name)
+ {
+ if ( isset($this->data[$name]) )
+ return $this->data[$name];
+ else
+ return $this->data[$name] = new set($this);
+ }
- function __set($name, $value)
- {
- $this->modified[$name] = $value;
- }
- }
+ function __set($name, $value)
+ {
+ $this->modified[$name] = $value;
+ }
+ }
- class set implements ArrayAccess
- {
- private $entity;
+ class set implements ArrayAccess
+ {
+ private $entity;
- function __construct($entity)
- {
- $this->entity = $entity;
- $this->entity->whatever = $this;
- }
+ function __construct($entity)
+ {
+ $this->entity = $entity;
+ $this->entity->whatever = $this;
+ }
- function clear() {
- $this->entity->whatever = null;
- }
+ function clear() {
+ $this->entity->whatever = null;
+ }
- function offsetUnset($offset)
- {
- $this->clear();
+ function offsetUnset($offset)
+ {
+ $this->clear();
// $this->entity->{$this->name} = null;
- }
+ }
- function offsetSet($offset, $value)
- {
- }
+ function offsetSet($offset, $value)
+ {
+ }
- function offsetGet($offset)
- {
- return 'Bogus ';
- }
+ function offsetGet($offset)
+ {
+ return 'Bogus ';
+ }
- function offsetExists($offset)
- {
- }
- }
+ function offsetExists($offset)
+ {
+ }
+ }
- $entity = new entity();
- echo($entity->whatever[0]);
+ $entity = new entity();
+ echo($entity->whatever[0]);
- //This will crash
+ //This will crash
// $entity->whatever->clear();
- unset($entity->whatever[0]);
+ unset($entity->whatever[0]);
- //This will not crash (comment previous & uncomment this to test
+ //This will not crash (comment previous & uncomment this to test
// $test = $entity->whatever; unset($test[0]);
- echo($entity->whatever[0]);
- echo "ok\n";
+ echo($entity->whatever[0]);
+ echo "ok\n";
?>
--EXPECT--
Bogus Bogus ok
diff --git a/Zend/tests/bug41026.phpt b/Zend/tests/bug41026.phpt
index e159ad36f6..0dde757d84 100644
--- a/Zend/tests/bug41026.phpt
+++ b/Zend/tests/bug41026.phpt
@@ -5,15 +5,15 @@ Bug #41026 (segfault when calling "self::method()" in shutdown functions)
class try_class
{
- static public function main ()
- {
- register_shutdown_function (array ("self", "on_shutdown"));
- }
+ static public function main ()
+ {
+ register_shutdown_function (array ("self", "on_shutdown"));
+ }
- static public function on_shutdown ()
- {
- printf ("CHECKPOINT\n"); /* never reached */
- }
+ static public function on_shutdown ()
+ {
+ printf ("CHECKPOINT\n"); /* never reached */
+ }
}
try_class::main ();
@@ -23,4 +23,4 @@ echo "Done\n";
--EXPECT--
Done
-Warning: (Registered shutdown functions) Unable to call self::on_shutdown() - function does not exist in Unknown on line 0
+Fatal error: Registered shutdown function self::on_shutdown() cannot be called, function does not exist in Unknown on line 0
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..441a9fc0b6 100644
--- a/Zend/tests/bug41209.phpt
+++ b/Zend/tests/bug41209.phpt
@@ -39,8 +39,8 @@ var_dump(isset($cache[$id]));
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Uncaught ErrorException: Undefined variable: id in %s:%d
+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/bug41401.phpt b/Zend/tests/bug41401.phpt
index 096091e439..69da880be5 100644
--- a/Zend/tests/bug41401.phpt
+++ b/Zend/tests/bug41401.phpt
@@ -5,6 +5,7 @@ Bug #41401 (wrong precedence for unary minus)
echo 1/-2*5;
echo "\n";
echo 6/+2*-3;
+?>
--EXPECT--
-2.5
-9
diff --git a/Zend/tests/bug41421.phpt b/Zend/tests/bug41421.phpt
index e4fa9447de..0cfee271a4 100644
--- a/Zend/tests/bug41421.phpt
+++ b/Zend/tests/bug41421.phpt
@@ -4,12 +4,12 @@ Bug #41421 (Uncaught exception from a stream wrapper segfaults)
<?php
class wrapper {
- function stream_open() {
- return true;
- }
- function stream_eof() {
- throw new exception();
- }
+ function stream_open() {
+ return true;
+ }
+ function stream_eof() {
+ throw new exception();
+ }
}
stream_wrapper_register("wrap", "wrapper");
diff --git a/Zend/tests/bug41633_1.phpt b/Zend/tests/bug41633_1.phpt
index 1c1d552dd7..7d32c7ff89 100644
--- a/Zend/tests/bug41633_1.phpt
+++ b/Zend/tests/bug41633_1.phpt
@@ -3,8 +3,8 @@ Bug #41633.1 (self:: doesn't work for constants)
--FILE--
<?php
class Foo {
- const A = self::B;
- const B = "ok";
+ const A = self::B;
+ const B = "ok";
}
echo Foo::A."\n";
?>
diff --git a/Zend/tests/bug41633_2.phpt b/Zend/tests/bug41633_2.phpt
index df6705645f..975d2218b5 100644
--- a/Zend/tests/bug41633_2.phpt
+++ b/Zend/tests/bug41633_2.phpt
@@ -3,12 +3,12 @@ Bug #41633.2 (Undefined class constants must not be substituted by strings)
--FILE--
<?php
class Foo {
- const A = self::B;
+ const A = self::B;
}
echo Foo::A."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined class constant 'self::B' in %sbug41633_2.php:5
+Fatal error: Uncaught Error: Undefined constant self::B in %s:%d
Stack trace:
#0 {main}
thrown in %sbug41633_2.php on line 5
diff --git a/Zend/tests/bug41633_3.phpt b/Zend/tests/bug41633_3.phpt
index dd4b75c9d9..4f78194a7e 100644
--- a/Zend/tests/bug41633_3.phpt
+++ b/Zend/tests/bug41633_3.phpt
@@ -3,13 +3,13 @@ Bug #41633.3 (Crash instantiating classes with self-referencing constants)
--FILE--
<?php
class Foo {
- const A = Foo::B;
- const B = Foo::A;
+ const A = Foo::B;
+ const B = Foo::A;
}
echo Foo::A;
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot declare self-referencing constant 'Foo::B' in %sbug41633_3.php:%d
+Fatal error: Uncaught Error: Cannot declare self-referencing constant Foo::B in %s:%d
Stack trace:
#0 {main}
thrown in %sbug41633_3.php on line %d
diff --git a/Zend/tests/bug41633_4.phpt b/Zend/tests/bug41633_4.phpt
index 3507f6a08c..c74cd7e45b 100644
--- a/Zend/tests/bug41633_4.phpt
+++ b/Zend/tests/bug41633_4.phpt
@@ -3,8 +3,8 @@ Bug #41633.4 (self:: doesn't work for constants)
--FILE--
<?php
class Foo {
- const A = self::B;
- const B = "ok";
+ const A = self::B;
+ const B = "ok";
}
var_dump(defined("Foo::A"));
?>
diff --git a/Zend/tests/bug41640.phpt b/Zend/tests/bug41640.phpt
index c859d90850..5bfc6f3472 100644
--- a/Zend/tests/bug41640.phpt
+++ b/Zend/tests/bug41640.phpt
@@ -8,6 +8,7 @@ class foo {
}
var_dump(get_class_vars("foo"));
+?>
--EXPECT--
array(1) {
["x"]=>
diff --git a/Zend/tests/bug42211.phpt b/Zend/tests/bug42211.phpt
index c6ea10652a..e331cf2e1e 100644
--- a/Zend/tests/bug42211.phpt
+++ b/Zend/tests/bug42211.phpt
@@ -20,6 +20,7 @@ $a = new A();
$a->foo();
$b = new B();
$b->foo();
+?>
--EXPECT--
bool(true)
bool(true)
diff --git a/Zend/tests/bug42798.phpt b/Zend/tests/bug42798.phpt
index 1141a30503..5f19fe3080 100644
--- a/Zend/tests/bug42798.phpt
+++ b/Zend/tests/bug42798.phpt
@@ -11,5 +11,6 @@ function foo($c = ok::constant) {
}
foo();
+?>
--EXPECT--
ok
diff --git a/Zend/tests/bug42802.phpt b/Zend/tests/bug42802.phpt
index ebfb528827..ec6c585e6e 100644
--- a/Zend/tests/bug42802.phpt
+++ b/Zend/tests/bug42802.phpt
@@ -8,7 +8,7 @@ class bar {
}
function test1(bar $bar) {
- echo "ok\n";
+ echo "ok\n";
}
function test2(\foo\bar $bar) {
@@ -18,7 +18,7 @@ function test3(\foo\bar $bar) {
echo "ok\n";
}
function test4(\Exception $e) {
- echo "ok\n";
+ echo "ok\n";
}
function test5(\bar $bar) {
echo "bug\n";
@@ -31,13 +31,14 @@ test2($x);
test3($x);
test4($y);
test5($x);
+?>
--EXPECTF--
ok
ok
ok
ok
-Fatal error: Uncaught TypeError: Argument 1 passed to foo\test5() must be an instance of bar, instance of foo\bar given, called in %sbug42802.php on line %d and defined in %sbug42802.php:%d
+Fatal error: Uncaught TypeError: foo\test5(): Argument #1 ($bar) must be of type bar, foo\bar given, called in %s:%d
Stack trace:
#0 %s(%d): foo\test5(Object(foo\bar))
#1 {main}
diff --git a/Zend/tests/bug42819.phpt b/Zend/tests/bug42819.phpt
index d0b5c0b2ee..d0615dae7f 100644
--- a/Zend/tests/bug42819.phpt
+++ b/Zend/tests/bug42819.phpt
@@ -19,65 +19,65 @@ const C = "foo\\C\n";
const I = 11;
class foo {
- const C = "foo\\foo::C\n";
- const I = 22;
- const C1 = C;
- const C2 = foo\C;
- const C3 = foo\foo::C;
- const C4 = \foo\C;
- const C5 = \foo\foo::C;
- const C6 = ArrayObject::STD_PROP_LIST;
- const C7 = E_ERROR;
+ const C = "foo\\foo::C\n";
+ const I = 22;
+ const C1 = C;
+ const C2 = foo\C;
+ const C3 = foo\foo::C;
+ const C4 = \foo\C;
+ const C5 = \foo\foo::C;
+ const C6 = ArrayObject::STD_PROP_LIST;
+ const C7 = E_ERROR;
}
class bar1 {
- static $a1 = array(I => 0);
- static $a2 = array(foo\I => 0);
- static $a3 = array(foo\foo::I => 0);
- static $a4 = array(\foo\I => 0);
- static $a5 = array(\foo\foo::I => 0);
- static $a6 = array(ArrayObject::STD_PROP_LIST => 0);
- static $a7 = array(E_ERROR => 0);
+ static $a1 = array(I => 0);
+ static $a2 = array(foo\I => 0);
+ static $a3 = array(foo\foo::I => 0);
+ static $a4 = array(\foo\I => 0);
+ static $a5 = array(\foo\foo::I => 0);
+ static $a6 = array(ArrayObject::STD_PROP_LIST => 0);
+ static $a7 = array(E_ERROR => 0);
}
class bar2 {
- static $a1 = array(I => I);
- static $a2 = array(foo\I => I);
- static $a3 = array(foo\foo::I => I);
- static $a4 = array(\foo\I => I);
- static $a5 = array(\foo\foo::I => I);
- static $a6 = array(ArrayObject::STD_PROP_LIST => I);
- static $a7 = array(E_ERROR => I);
+ static $a1 = array(I => I);
+ static $a2 = array(foo\I => I);
+ static $a3 = array(foo\foo::I => I);
+ static $a4 = array(\foo\I => I);
+ static $a5 = array(\foo\foo::I => I);
+ static $a6 = array(ArrayObject::STD_PROP_LIST => I);
+ static $a7 = array(E_ERROR => I);
}
class bar3 {
- static $a1 = array(I => foo\I);
- static $a2 = array(foo\I => foo\I);
- static $a3 = array(foo\foo::I => foo\I);
- static $a4 = array(\foo\I => foo\I);
- static $a5 = array(\foo\foo::I => foo\I);
- static $a6 = array(ArrayObject::STD_PROP_LIST => foo\I);
- static $a7 = array(E_ERROR => foo\I);
+ static $a1 = array(I => foo\I);
+ static $a2 = array(foo\I => foo\I);
+ static $a3 = array(foo\foo::I => foo\I);
+ static $a4 = array(\foo\I => foo\I);
+ static $a5 = array(\foo\foo::I => foo\I);
+ static $a6 = array(ArrayObject::STD_PROP_LIST => foo\I);
+ static $a7 = array(E_ERROR => foo\I);
}
class bar4 {
- static $a1 = array(I => ArrayObject::STD_PROP_LIST);
- static $a2 = array(foo\I => ArrayObject::STD_PROP_LIST);
- static $a3 = array(foo\foo::I => ArrayObject::STD_PROP_LIST);
- static $a4 = array(\foo\I => ArrayObject::STD_PROP_LIST);
- static $a5 = array(\foo\foo::I => ArrayObject::STD_PROP_LIST);
- static $a6 = array(ArrayObject::STD_PROP_LIST => ArrayObject::STD_PROP_LIST);
- static $a7 = array(E_ERROR => ArrayObject::STD_PROP_LIST);
+ static $a1 = array(I => ArrayObject::STD_PROP_LIST);
+ static $a2 = array(foo\I => ArrayObject::STD_PROP_LIST);
+ static $a3 = array(foo\foo::I => ArrayObject::STD_PROP_LIST);
+ static $a4 = array(\foo\I => ArrayObject::STD_PROP_LIST);
+ static $a5 = array(\foo\foo::I => ArrayObject::STD_PROP_LIST);
+ static $a6 = array(ArrayObject::STD_PROP_LIST => ArrayObject::STD_PROP_LIST);
+ static $a7 = array(E_ERROR => ArrayObject::STD_PROP_LIST);
}
class bar5 {
- static $a1 = array(I => E_ERROR);
- static $a2 = array(foo\I => E_ERROR);
- static $a3 = array(foo\foo::I => E_ERROR);
- static $a4 = array(\foo\I => E_ERROR);
- static $a5 = array(\foo\foo::I => E_ERROR);
- static $a6 = array(ArrayObject::STD_PROP_LIST => E_ERROR);
- static $a7 = array(E_ERROR => E_ERROR);
+ static $a1 = array(I => E_ERROR);
+ static $a2 = array(foo\I => E_ERROR);
+ static $a3 = array(foo\foo::I => E_ERROR);
+ static $a4 = array(\foo\I => E_ERROR);
+ static $a5 = array(\foo\foo::I => E_ERROR);
+ static $a6 = array(ArrayObject::STD_PROP_LIST => E_ERROR);
+ static $a7 = array(E_ERROR => E_ERROR);
}
echo "first\n";
@@ -297,7 +297,7 @@ Array
[1] => 1
)
-Fatal error: Uncaught Error: Undefined constant 'foo\foo\unknown' in %sbug42819.php:%d
+Fatal error: Uncaught Error: Undefined constant "foo\foo\unknown" in %s:%d
Stack trace:
#0 %s(%d): foo\oops()
#1 {main}
diff --git a/Zend/tests/bug42820.phpt b/Zend/tests/bug42820.phpt
index a53ed1af68..0c2b85044d 100644
--- a/Zend/tests/bug42820.phpt
+++ b/Zend/tests/bug42820.phpt
@@ -5,7 +5,7 @@ Bug #42820 (defined() on constant with namespace prefixes tries to load class)
namespace ns;
const ok = 0;
class foo {
- const ok = 0;
+ const ok = 0;
}
var_dump(defined('ns\\ok'));
var_dump(defined('ns\\bug'));
@@ -17,6 +17,7 @@ var_dump(defined('\\ns\\foo::ok'));
var_dump(defined('\\ns\\foo::bug'));
var_dump(defined('ns\\bar::bug'));
var_dump(defined('\\ns\\bar::bug'));
+?>
--EXPECT--
bool(true)
bool(false)
diff --git a/Zend/tests/bug42937.phpt b/Zend/tests/bug42937.phpt
index 2ade186b9c..cedcf073a6 100644
--- a/Zend/tests/bug42937.phpt
+++ b/Zend/tests/bug42937.phpt
@@ -3,26 +3,26 @@ Bug #42937 (__call() method not invoked when methods are called on parent from c
--FILE--
<?php
class A {
- function __call($strMethod, $arrArgs) {
- echo "$strMethod\n";
- }
+ function __call($strMethod, $arrArgs) {
+ echo "$strMethod\n";
+ }
}
class C {
- function __call($strMethod, $arrArgs) {
- echo "$strMethod\n";
- }
+ function __call($strMethod, $arrArgs) {
+ echo "$strMethod\n";
+ }
}
class B extends A {
- function test() {
- self::test1();
- parent::test2();
- static::test3();
- A::test4();
- B::test5();
- C::test6();
- }
+ function test() {
+ self::test1();
+ parent::test2();
+ static::test3();
+ A::test4();
+ B::test5();
+ C::test6();
+ }
}
$a = new A();
@@ -39,7 +39,7 @@ test3
test4
test5
-Fatal error: Uncaught Error: Call to undefined method C::test6() in %sbug42937.php:21
+Fatal error: Uncaught Error: Call to undefined method C::test6() in %s:%d
Stack trace:
#0 %s(%d): B->test()
#1 {main}
diff --git a/Zend/tests/bug43183.phpt b/Zend/tests/bug43183.phpt
index 88641e862a..b09feefabc 100644
--- a/Zend/tests/bug43183.phpt
+++ b/Zend/tests/bug43183.phpt
@@ -8,5 +8,6 @@ class Foo {}
class Bar {}
use Test\Bar;
echo "ok\n";
+?>
--EXPECT--
ok
diff --git a/Zend/tests/bug43200.phpt b/Zend/tests/bug43200.phpt
index be94a64531..e0da6e16ae 100644
--- a/Zend/tests/bug43200.phpt
+++ b/Zend/tests/bug43200.phpt
@@ -4,19 +4,19 @@ Bug #43200 (Interface implementation / inheritance not possible in abstract clas
<?php
interface a {
- function foo();
- function bar();
+ function foo();
+ function bar();
}
interface b {
- function foo();
+ function foo();
}
abstract class c {
- function bar() { }
+ function bar() { }
}
class x extends c implements a, b {
- function foo() { }
+ function foo() { }
}
echo new ReflectionClass('x');
diff --git a/Zend/tests/bug43200_2.phpt b/Zend/tests/bug43200_2.phpt
index 8926173aee..f20fe3ddce 100644
--- a/Zend/tests/bug43200_2.phpt
+++ b/Zend/tests/bug43200_2.phpt
@@ -4,17 +4,17 @@ Bug #43200.2 (Interface implementation / inheritance not possible in abstract cl
<?php
interface A {
- function foo();
+ function foo();
}
abstract class B implements A {
- abstract public function foo();
+ abstract public function foo();
}
class C extends B {
- public function foo() {
- echo 'works';
- }
+ public function foo() {
+ echo 'works';
+ }
}
$o = new C();
diff --git a/Zend/tests/bug43201.phpt b/Zend/tests/bug43201.phpt
index 2ab26ca4b9..49816ea1c1 100644
--- a/Zend/tests/bug43201.phpt
+++ b/Zend/tests/bug43201.phpt
@@ -3,12 +3,12 @@ Bug #43201 (Crash on using uninitialized vals and __get/__set)
--FILE--
<?php
class Foo {
- function __get($k) {
- return null;
- }
- function __set($k, $v) {
- $this->$k = $v;
- }
+ function __get($k) {
+ return null;
+ }
+ function __set($k, $v) {
+ $this->$k = $v;
+ }
}
$c = new Foo();
@@ -16,8 +16,8 @@ $c = new Foo();
$c->arr[0]["k"] = 1;
$c->arr[0]["k2"] = $ref;
for($cnt=0;$cnt<6;$cnt++) {
- $ref = chop($undef);
- $c->arr[$cnt]["k2"] = $ref;
+ $ref = chop($undef);
+ $c->arr[$cnt]["k2"] = $ref;
}
echo "ok\n";
?>
@@ -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/bug43332_1.phpt b/Zend/tests/bug43332_1.phpt
index fc035ab2b6..35d817c985 100644
--- a/Zend/tests/bug43332_1.phpt
+++ b/Zend/tests/bug43332_1.phpt
@@ -11,8 +11,9 @@ class foo {
$foo = new foo;
$foo->bar($foo); // Ok!
$foo->bar(new \stdclass); // Error, ok!
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to foobar\foo::bar() must be an instance of foobar\foo, instance of stdClass given, called in %sbug43332_1.php on line 10 and defined in %sbug43332_1.php:5
+Fatal error: Uncaught TypeError: foobar\foo::bar(): Argument #1 ($a) must be of type foobar\foo, stdClass given, called in %s:%d
Stack trace:
#0 %s(%d): foobar\foo->bar(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/bug43332_2.phpt b/Zend/tests/bug43332_2.phpt
index b8adef3b13..604479e606 100644
--- a/Zend/tests/bug43332_2.phpt
+++ b/Zend/tests/bug43332_2.phpt
@@ -11,5 +11,6 @@ class foo {
$foo = new foo;
$foo->bar($foo); // Ok!
$foo->bar(new stdclass); // Error, ok!
+?>
--EXPECTF--
Fatal error: '\self' is an invalid class name in %sbug43332_2.php on line 5
diff --git a/Zend/tests/bug43343.phpt b/Zend/tests/bug43343.phpt
index 79b3e5a24a..748562e985 100644
--- a/Zend/tests/bug43343.phpt
+++ b/Zend/tests/bug43343.phpt
@@ -8,4 +8,4 @@ $foo = 'bar';
var_dump(new namespace::$foo);
?>
--EXPECTF--
-Parse error: %s error%sexpecting%sT_NS_SEPARATOR%sin %sbug43343.php on line 5
+Parse error: syntax error, unexpected token "namespace", expecting ":" in %s on line %d
diff --git a/Zend/tests/bug43344_1.phpt b/Zend/tests/bug43344_1.phpt
index 4635240699..d517373d9f 100644
--- a/Zend/tests/bug43344_1.phpt
+++ b/Zend/tests/bug43344_1.phpt
@@ -3,30 +3,43 @@ Bug #43344.1 (Wrong error message for undefined namespace constant)
--FILE--
<?php
namespace Foo;
+use Error;
+
function f1($a=bar) {
- return $a;
+ return $a;
}
function f2($a=array(bar)) {
- return $a[0];
+ return $a[0];
}
function f3($a=array(bar=>0)) {
- reset($a);
- return key($a);
+ 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/bug43344_10.phpt b/Zend/tests/bug43344_10.phpt
index 4916b039e1..31aa09c3c0 100644
--- a/Zend/tests/bug43344_10.phpt
+++ b/Zend/tests/bug43344_10.phpt
@@ -5,7 +5,7 @@ Bug #43344.10 (Wrong error message for undefined namespace constant)
echo namespace\bar."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'bar' in %sbug43344_10.php:%d
+Fatal error: Uncaught Error: Undefined constant "bar" in %s:%d
Stack trace:
#0 {main}
thrown in %sbug43344_10.php on line %d
diff --git a/Zend/tests/bug43344_11.phpt b/Zend/tests/bug43344_11.phpt
index 27c3160f5a..6ddae2e473 100644
--- a/Zend/tests/bug43344_11.phpt
+++ b/Zend/tests/bug43344_11.phpt
@@ -3,12 +3,12 @@ Bug #43344.11 (Wrong error message for undefined namespace constant)
--FILE--
<?php
function f($a=namespace\bar) {
- return $a;
+ return $a;
}
echo f()."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'bar' in %sbug43344_11.php:%d
+Fatal error: Uncaught Error: Undefined constant "bar" in %s:%d
Stack trace:
#0 %s(%d): f()
#1 {main}
diff --git a/Zend/tests/bug43344_12.phpt b/Zend/tests/bug43344_12.phpt
index 71031f5819..91e00fb79e 100644
--- a/Zend/tests/bug43344_12.phpt
+++ b/Zend/tests/bug43344_12.phpt
@@ -3,12 +3,12 @@ Bug #43344.12 (Wrong error message for undefined namespace constant)
--FILE--
<?php
function f($a=array(namespace\bar)) {
- return $a[0];
+ return $a[0];
}
echo f()."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'bar' in %sbug43344_12.php:%d
+Fatal error: Uncaught Error: Undefined constant "bar" in %s:%d
Stack trace:
#0 %s(%d): f()
#1 {main}
diff --git a/Zend/tests/bug43344_13.phpt b/Zend/tests/bug43344_13.phpt
index bdce5a8a75..9d93520184 100644
--- a/Zend/tests/bug43344_13.phpt
+++ b/Zend/tests/bug43344_13.phpt
@@ -3,13 +3,13 @@ Bug #43344.13 (Wrong error message for undefined namespace constant)
--FILE--
<?php
function f($a=array(namespace\bar=>0)) {
- reset($a);
- return key($a);
+ reset($a);
+ return key($a);
}
echo f()."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'bar' in %sbug43344_13.php:%d
+Fatal error: Uncaught Error: Undefined constant "bar" in %s:%d
Stack trace:
#0 %s(%d): f()
#1 {main}
diff --git a/Zend/tests/bug43344_2.phpt b/Zend/tests/bug43344_2.phpt
index 081f339a41..982d8ecacc 100644
--- a/Zend/tests/bug43344_2.phpt
+++ b/Zend/tests/bug43344_2.phpt
@@ -6,7 +6,7 @@ namespace Foo;
echo Foo::bar."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Class 'Foo\Foo' not found in %sbug43344_2.php:%d
+Fatal error: Uncaught Error: Class "Foo\Foo" not found in %s:%d
Stack trace:
#0 {main}
thrown in %sbug43344_2.php on line %d
diff --git a/Zend/tests/bug43344_3.phpt b/Zend/tests/bug43344_3.phpt
index 5450759bcc..ebef53c94b 100644
--- a/Zend/tests/bug43344_3.phpt
+++ b/Zend/tests/bug43344_3.phpt
@@ -4,12 +4,12 @@ Bug #43344.3 (Wrong error message for undefined namespace constant)
<?php
namespace Foo;
function f($a=Foo::bar) {
- return $a;
+ return $a;
}
echo f()."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Class 'Foo\Foo' not found in %s:%d
+Fatal error: Uncaught Error: Class "Foo\Foo" not found in %s:%d
Stack trace:
#0 %s(%d): Foo\f()
#1 {main}
diff --git a/Zend/tests/bug43344_4.phpt b/Zend/tests/bug43344_4.phpt
index c147766bf6..a7b9b8c9b6 100644
--- a/Zend/tests/bug43344_4.phpt
+++ b/Zend/tests/bug43344_4.phpt
@@ -4,12 +4,12 @@ Bug #43344.4 (Wrong error message for undefined namespace constant)
<?php
namespace Foo;
function f($a=array(Foo::bar)) {
- return $a[0];
+ return $a[0];
}
echo f()."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Class 'Foo\Foo' not found in %s:%d
+Fatal error: Uncaught Error: Class "Foo\Foo" not found in %s:%d
Stack trace:
#0 %s(%d): Foo\f()
#1 {main}
diff --git a/Zend/tests/bug43344_5.phpt b/Zend/tests/bug43344_5.phpt
index 8cc333fd31..0bc11e697c 100644
--- a/Zend/tests/bug43344_5.phpt
+++ b/Zend/tests/bug43344_5.phpt
@@ -4,13 +4,13 @@ Bug #43344.5 (Wrong error message for undefined namespace constant)
<?php
namespace Foo;
function f($a=array(Foo::bar=>0)) {
- reset($a);
- return key($a);
+ reset($a);
+ return key($a);
}
echo f()."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Class 'Foo\Foo' not found in %s:%d
+Fatal error: Uncaught Error: Class "Foo\Foo" not found in %s:%d
Stack trace:
#0 %s(%d): Foo\f()
#1 {main}
diff --git a/Zend/tests/bug43344_6.phpt b/Zend/tests/bug43344_6.phpt
index 45aac8281f..5fb661d685 100644
--- a/Zend/tests/bug43344_6.phpt
+++ b/Zend/tests/bug43344_6.phpt
@@ -6,7 +6,7 @@ namespace Foo;
echo namespace\bar."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'Foo\bar' in %sbug43344_6.php:%d
+Fatal error: Uncaught Error: Undefined constant "Foo\bar" in %s:%d
Stack trace:
#0 {main}
thrown in %sbug43344_6.php on line %d
diff --git a/Zend/tests/bug43344_7.phpt b/Zend/tests/bug43344_7.phpt
index dfab0cad90..f0c42cdf41 100644
--- a/Zend/tests/bug43344_7.phpt
+++ b/Zend/tests/bug43344_7.phpt
@@ -4,12 +4,12 @@ Bug #43344.7 (Wrong error message for undefined namespace constant)
<?php
namespace Foo;
function f($a=namespace\bar) {
- return $a;
+ return $a;
}
echo f()."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'Foo\bar' in %sbug43344_7.php:%d
+Fatal error: Uncaught Error: Undefined constant "Foo\bar" in %s:%d
Stack trace:
#0 %s(%d): Foo\f()
#1 {main}
diff --git a/Zend/tests/bug43344_8.phpt b/Zend/tests/bug43344_8.phpt
index b1e6f61a54..b22aed6367 100644
--- a/Zend/tests/bug43344_8.phpt
+++ b/Zend/tests/bug43344_8.phpt
@@ -4,12 +4,12 @@ Bug #43344.8 (Wrong error message for undefined namespace constant)
<?php
namespace Foo;
function f($a=array(namespace\bar)) {
- return $a[0];
+ return $a[0];
}
echo f()."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'Foo\bar' in %sbug43344_8.php:%d
+Fatal error: Uncaught Error: Undefined constant "Foo\bar" in %s:%d
Stack trace:
#0 %s(%d): Foo\f()
#1 {main}
diff --git a/Zend/tests/bug43344_9.phpt b/Zend/tests/bug43344_9.phpt
index 7f7f2df38f..7483e0840b 100644
--- a/Zend/tests/bug43344_9.phpt
+++ b/Zend/tests/bug43344_9.phpt
@@ -4,13 +4,13 @@ Bug #43344.9 (Wrong error message for undefined namespace constant)
<?php
namespace Foo;
function f($a=array(namespace\bar=>0)) {
- reset($a);
- return key($a);
+ reset($a);
+ return key($a);
}
echo f()."\n";
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'Foo\bar' in %sbug43344_9.php:%d
+Fatal error: Uncaught Error: Undefined constant "Foo\bar" in %s:%d
Stack trace:
#0 %s(%d): Foo\f()
#1 {main}
diff --git a/Zend/tests/bug43450.phpt b/Zend/tests/bug43450.phpt
index 05f2f7cbf6..f47f491471 100644
--- a/Zend/tests/bug43450.phpt
+++ b/Zend/tests/bug43450.phpt
@@ -8,9 +8,9 @@ opcache.enable_cli=0
class Foo
{
public function __toString()
- {
- return __CLASS__;
- }
+ {
+ return __CLASS__;
+ }
}
$num_repeats = 100000;
@@ -18,15 +18,15 @@ $num_repeats = 100000;
$start = memory_get_usage() / 1024;
for ($i=1;$i<$num_repeats;$i++)
{
- $foo = new Foo();
- md5($foo);
+ $foo = new Foo();
+ md5($foo);
}
$end = memory_get_usage() / 1024;
if ($start + 16 < $end) {
- echo 'FAIL';
+ echo 'FAIL';
} else {
- echo 'PASS';
+ echo 'PASS';
}
?>
diff --git a/Zend/tests/bug43483.phpt b/Zend/tests/bug43483.phpt
index 0cfbfe8780..b82fc96aea 100644
--- a/Zend/tests/bug43483.phpt
+++ b/Zend/tests/bug43483.phpt
@@ -3,15 +3,15 @@ Bug #43483 (get_class_methods() does not list all visible methods)
--FILE--
<?php
class C {
- public static function test() {
- D::prot();
- print_r(get_class_methods("D"));
- }
+ public static function test() {
+ D::prot();
+ print_r(get_class_methods("D"));
+ }
}
class D extends C {
- protected static function prot() {
- echo "Successfully called D::prot().\n";
- }
+ protected static function prot() {
+ echo "Successfully called D::prot().\n";
+ }
}
D::test();
?>
diff --git a/Zend/tests/bug43651.phpt b/Zend/tests/bug43651.phpt
index ea70cf1039..a822bd4589 100644
--- a/Zend/tests/bug43651.phpt
+++ b/Zend/tests/bug43651.phpt
@@ -22,6 +22,7 @@ var_dump(is_callable("Test::foo"));
var_dump(is_callable("\\Test::foo"));
var_dump(is_callable("is_string"));
var_dump(is_callable("\\is_string"));
+?>
--EXPECT--
bool(false)
bool(false)
diff --git a/Zend/tests/bug43851.phpt b/Zend/tests/bug43851.phpt
index e19e393df0..7b0de5b117 100644
--- a/Zend/tests/bug43851.phpt
+++ b/Zend/tests/bug43851.phpt
@@ -4,9 +4,9 @@ Bug #43851 (Memory corrution on reuse of assigned value)
<?php
foo();
function foo() {
- global $LAST;
- ($LAST = $LAST + 0) * 1;
- echo "ok\n";
+ global $LAST;
+ ($LAST = $LAST + 0) * 1;
+ echo "ok\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/bug44069.phpt b/Zend/tests/bug44069.phpt
index 75beaafed7..b18e16b254 100644
--- a/Zend/tests/bug44069.phpt
+++ b/Zend/tests/bug44069.phpt
@@ -8,12 +8,12 @@ $string = str_repeat('This is a teststring.', 50);
for($i = 1; $i <= 2000; $i++)
{
// $newstring .= $string; //This uses an expected amount of mem.
- $newstring = $newstring . $string; //This uses very much mem.
+ $newstring = $newstring . $string; //This uses very much mem.
- for($j = 1; $j <= 10; $j++)
- {
- $array[] = 'test';
- }
+ for($j = 1; $j <= 10; $j++)
+ {
+ $array[] = 'test';
+ }
}
echo "ok\n";
?>
diff --git a/Zend/tests/bug44141.phpt b/Zend/tests/bug44141.phpt
index 5ea737e46a..b9214559c9 100644
--- a/Zend/tests/bug44141.phpt
+++ b/Zend/tests/bug44141.phpt
@@ -21,8 +21,9 @@ class Y extends X
$y = Y::cheat(5);
echo $y->x, PHP_EOL;
+?>
--EXPECTF--
-Fatal error: Uncaught Error: Call to private X::__construct() from context 'Y' in %sbug44141.php:15
+Fatal error: Uncaught Error: Call to private X::__construct() from scope Y in %s:%d
Stack trace:
#0 %s(%d): Y::cheat(5)
#1 {main}
diff --git a/Zend/tests/bug44184.phpt b/Zend/tests/bug44184.phpt
index 7f277acc74..e6e72554ad 100644
--- a/Zend/tests/bug44184.phpt
+++ b/Zend/tests/bug44184.phpt
@@ -3,18 +3,18 @@ Bug #44184 (Double free of loop-variable on exception)
--FILE--
<?php
function foo() {
- $x = array(1,2,3);
- foreach ($x as $a) {
- while (1) {
- throw new Exception();
- }
- return;
- }
+ $x = array(1,2,3);
+ foreach ($x as $a) {
+ while (1) {
+ throw new Exception();
+ }
+ return;
+ }
}
try {
- foo();
+ foo();
} catch (Exception $ex) {
- echo "ok\n";
+ echo "ok\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/bug44653.phpt b/Zend/tests/bug44653.phpt
index 28e1d8ef71..8657beba00 100644
--- a/Zend/tests/bug44653.phpt
+++ b/Zend/tests/bug44653.phpt
@@ -8,10 +8,10 @@ function fooBar() { echo __FUNCTION__ . PHP_EOL; }
namespace B;
class A {
- static function fooBar() { echo "bag1\n"; }
+ static function fooBar() { echo "bag1\n"; }
}
class B {
- static function fooBar() { echo "bag2\n"; }
+ static function fooBar() { echo "bag2\n"; }
}
function fooBar() { echo __FUNCTION__ . PHP_EOL; }
var_dump(\A\XX);
diff --git a/Zend/tests/bug44660.phpt b/Zend/tests/bug44660.phpt
index 980c2274cd..1d81677f12 100644
--- a/Zend/tests/bug44660.phpt
+++ b/Zend/tests/bug44660.phpt
@@ -5,45 +5,65 @@ Bug #44660 (Indexed and reference assignment to property of non-object don't tri
$s = "hello";
$a = true;
-echo "--> read access: ";
+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
+--> read access:
+Warning: Attempt to read property "p" on bool 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" on bool
---> increment:
-Warning: Attempt to increment/decrement property 'p' of non-object in %sbug44660.php on line 12
+--> increment:
+Attempt to increment/decrement property "p" on bool
--> reference assignment:
-Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 15
+Attempt to modify property "p" on bool
--> reference assignment:
-Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 18
+Attempt to modify property "p" on bool
--> indexed assignment:
-Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 21
+Attempt to modify property "p" on bool
--> Confirm assignments have had no impact:
bool(true)
diff --git a/Zend/tests/bug44827.phpt b/Zend/tests/bug44827.phpt
index a9f1d87d24..8e51087480 100644
--- a/Zend/tests/bug44827.phpt
+++ b/Zend/tests/bug44827.phpt
@@ -2,10 +2,20 @@
Bug #44827 (define() allows :: in constant names)
--FILE--
<?php
-define('foo::bar', 1);
-define('::', 1);
-?>
---EXPECTF--
-Warning: Class constants cannot be defined or redefined in %sbug44827.php on line %d
-Warning: Class constants cannot be defined or redefined in %sbug44827.php on line %d
+try {
+ define('foo::bar', 1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ define('::', 1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+define(): Argument #1 ($constant_name) cannot be a class constant
+define(): Argument #1 ($constant_name) cannot be a class constant
diff --git a/Zend/tests/bug44899.phpt b/Zend/tests/bug44899.phpt
index d62033a24e..bebbe33a9f 100644
--- a/Zend/tests/bug44899.phpt
+++ b/Zend/tests/bug44899.phpt
@@ -5,17 +5,17 @@ Bug #44899 (__isset usage changes behavior of empty())
class myclass
{
- private $_data = array();
+ private $_data = array();
- function __construct($data)
- {
- $this->_data = $data;
- }
+ function __construct($data)
+ {
+ $this->_data = $data;
+ }
- function __isset($field_name)
- {
- return isset($this->_data[$field_name]);
- }
+ function __isset($field_name)
+ {
+ return isset($this->_data[$field_name]);
+ }
}
$arr = array('foo' => '');
@@ -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/bug44899_2.phpt b/Zend/tests/bug44899_2.phpt
index f3ff50604c..ff4412979a 100644
--- a/Zend/tests/bug44899_2.phpt
+++ b/Zend/tests/bug44899_2.phpt
@@ -5,22 +5,22 @@ Bug #44899 (__isset usage changes behavior of empty()) - 2
class myclass
{
- private $_data = array();
-
- function __construct($data)
- {
- $this->_data = $data;
- }
-
- function __isset($field_name)
- {
- return isset($this->_data[$field_name]);
- }
-
- function __get($var) {
- var_dump(empty($this->_data[$var]));
- return $this->_data[$var];
- }
+ private $_data = array();
+
+ function __construct($data)
+ {
+ $this->_data = $data;
+ }
+
+ function __isset($field_name)
+ {
+ return isset($this->_data[$field_name]);
+ }
+
+ function __get($var) {
+ var_dump(empty($this->_data[$var]));
+ return $this->_data[$var];
+ }
}
$arr = array('foo' => '');
diff --git a/Zend/tests/bug45147.phpt b/Zend/tests/bug45147.phpt
index b940777d12..eb5d89c702 100644
--- a/Zend/tests/bug45147.phpt
+++ b/Zend/tests/bug45147.phpt
@@ -2,7 +2,7 @@
Bug #45147 (unexpected T_ENDFOR)
--FILE--
<?php for ($i = 0; $i == 0; $i++): ?>
- <?php if (true): ?>#<?php else: ?>#<?php endif; ?>
+ <?php if (true): ?>#<?php else: ?>#<?php endif; ?>
<?php endfor; ?>
--EXPECT--
#
diff --git a/Zend/tests/bug45180.phpt b/Zend/tests/bug45180.phpt
index 285543aaf0..77daa07b4d 100644
--- a/Zend/tests/bug45180.phpt
+++ b/Zend/tests/bug45180.phpt
@@ -4,21 +4,21 @@ Testing callback formats within class method
<?php
class foo {
- public function test() {
- call_user_func(array('FOO', 'ABC'));
- call_user_func(array($this, 'ABC'));
- foo::XYZ();
- self::WWW();
- call_user_func('FOO::ABC');
- }
- function __call($a, $b) {
- print "__call:\n";
- var_dump($a);
- }
- static public function __callStatic($a, $b) {
- print "__callstatic:\n";
- var_dump($a);
- }
+ public function test() {
+ call_user_func(array('FOO', 'ABC'));
+ call_user_func(array($this, 'ABC'));
+ foo::XYZ();
+ self::WWW();
+ call_user_func('FOO::ABC');
+ }
+ function __call($a, $b) {
+ print "__call:\n";
+ var_dump($a);
+ }
+ static public function __callStatic($a, $b) {
+ print "__callstatic:\n";
+ var_dump($a);
+ }
}
$x = new foo;
diff --git a/Zend/tests/bug45186.phpt b/Zend/tests/bug45186.phpt
index 411c2ea072..1a18e38004 100644
--- a/Zend/tests/bug45186.phpt
+++ b/Zend/tests/bug45186.phpt
@@ -4,25 +4,25 @@ Bug #45186 (__call depends on __callstatic in class scope)
<?php
class bar {
- public function __call($a, $b) {
- print "__call:\n";
- var_dump($a);
- }
- static public function __callstatic($a, $b) {
- print "__callstatic:\n";
- var_dump($a);
- }
- public function test() {
- self::ABC();
- bar::ABC();
- call_user_func(array('BAR', 'xyz'));
- call_user_func('BAR::www');
- call_user_func(array('self', 'y'));
- call_user_func('self::y');
- }
- static function x() {
- print "ok\n";
- }
+ public function __call($a, $b) {
+ print "__call:\n";
+ var_dump($a);
+ }
+ static public function __callstatic($a, $b) {
+ print "__callstatic:\n";
+ var_dump($a);
+ }
+ public function test() {
+ self::ABC();
+ bar::ABC();
+ call_user_func(array('BAR', 'xyz'));
+ call_user_func('BAR::www');
+ call_user_func(array('self', 'y'));
+ call_user_func('self::y');
+ }
+ static function x() {
+ print "ok\n";
+ }
}
$x = new bar;
@@ -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(): Argument #1 ($function) must 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..960c38196e 100644
--- a/Zend/tests/bug45186_2.phpt
+++ b/Zend/tests/bug45186_2.phpt
@@ -4,21 +4,21 @@ Bug #45186.2 (__call depends on __callstatic in class scope)
<?php
class bar {
- public function __call($a, $b) {
- print "__call:\n";
- var_dump($a);
- }
- public function test() {
- self::ABC();
- bar::ABC();
- call_user_func(array('BAR', 'xyz'));
- call_user_func('BAR::www');
- call_user_func(array('self', 'y'));
- call_user_func('self::y');
- }
- static function x() {
- print "ok\n";
- }
+ public function __call($a, $b) {
+ print "__call:\n";
+ var_dump($a);
+ }
+ public function test() {
+ self::ABC();
+ bar::ABC();
+ call_user_func(array('BAR', 'xyz'));
+ call_user_func('BAR::www');
+ call_user_func(array('self', 'y'));
+ call_user_func('self::y');
+ }
+ static function x() {
+ print "ok\n";
+ }
}
$x = new bar;
@@ -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(): Argument #1 ($function) must be a valid callback, class bar does not have a method "www"
+call_user_func(): Argument #1 ($function) must be a valid callback, cannot access "self" when no class scope is active
diff --git a/Zend/tests/bug45744.phpt b/Zend/tests/bug45744.phpt
index c1e2a4841c..06d2eb929c 100644
--- a/Zend/tests/bug45744.phpt
+++ b/Zend/tests/bug45744.phpt
@@ -4,14 +4,14 @@ Bug #45744 (Case sensitive callback behaviour)
<?php
class Foo {
public function __construct(array $data) {
- var_dump(array_map(array($this, 'callback'), $data));
+ var_dump(array_map(array($this, 'callback'), $data));
}
private function callback($value) {
if (!is_array($value)) {
return stripslashes($value);
}
- return array_map(array($this, 'callback'), $value);
+ return array_map(array($this, 'callback'), $value);
}
}
@@ -22,7 +22,7 @@ new Bar(array());
class Foo2 {
public function __construct(array $data) {
- var_dump(array_map(array($this, 'callBack'), $data));
+ var_dump(array_map(array($this, 'callBack'), $data));
}
private function callBack($value) {
@@ -33,6 +33,7 @@ class Bar2 extends Foo2 {
}
new Bar2(array());
+?>
--EXPECT--
array(0) {
}
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/bug45877.phpt b/Zend/tests/bug45877.phpt
index ec44cb061f..79c3020f20 100644
--- a/Zend/tests/bug45877.phpt
+++ b/Zend/tests/bug45877.phpt
@@ -5,10 +5,10 @@ precision=16
--FILE--
<?php
$keys = array(PHP_INT_MAX,
- (string) PHP_INT_MAX,
- (string) (-PHP_INT_MAX - 1),
- -PHP_INT_MAX - 1,
- (string) (PHP_INT_MAX + 1));
+ (string) PHP_INT_MAX,
+ (string) (-PHP_INT_MAX - 1),
+ -PHP_INT_MAX - 1,
+ (string) (PHP_INT_MAX + 1));
var_dump(array_fill_keys($keys, 1));
?>
diff --git a/Zend/tests/bug45910.phpt b/Zend/tests/bug45910.phpt
index 7f2ea8b205..172443482a 100644
--- a/Zend/tests/bug45910.phpt
+++ b/Zend/tests/bug45910.phpt
@@ -4,20 +4,20 @@ Bug #45910 (Cannot declare self-referencing constant)
<?php
class foo {
- const AAA = 'x';
- const BBB = 'a';
- const CCC = 'a';
- const DDD = self::AAA;
+ const AAA = 'x';
+ const BBB = 'a';
+ const CCC = 'a';
+ const DDD = self::AAA;
- private static $foo = array(
- self::BBB => 'a',
- self::CCC => 'b',
- self::DDD => self::AAA
- );
+ private static $foo = array(
+ self::BBB => 'a',
+ self::CCC => 'b',
+ self::DDD => self::AAA
+ );
- public static function test() {
- self::$foo;
- }
+ public static function test() {
+ self::$foo;
+ }
}
foo::test();
diff --git a/Zend/tests/bug45910_2.phpt b/Zend/tests/bug45910_2.phpt
index dec6565c0e..a93f424f4d 100644
--- a/Zend/tests/bug45910_2.phpt
+++ b/Zend/tests/bug45910_2.phpt
@@ -4,20 +4,20 @@ Bug #45910.2 (Cannot declare self-referencing constant)
<?php
class foo {
- const AAA = 'x';
- const BBB = 'a';
- const CCC = 'a';
- const DDD = self::AAA;
+ const AAA = 'x';
+ const BBB = 'a';
+ const CCC = 'a';
+ const DDD = self::AAA;
- private static $foo = array(
- self::BBB => 'a',
- self::CCC => 'b',
- self::DDD => 11
- );
+ private static $foo = array(
+ self::BBB => 'a',
+ self::CCC => 'b',
+ self::DDD => 11
+ );
- public static function test() {
- self::$foo;
- }
+ public static function test() {
+ self::$foo;
+ }
}
foo::test();
diff --git a/Zend/tests/bug46106.phpt b/Zend/tests/bug46106.phpt
index f18c25a6c2..7f0ae66deb 100644
--- a/Zend/tests/bug46106.phpt
+++ b/Zend/tests/bug46106.phpt
@@ -9,14 +9,19 @@ function foobar($errno, $errstr, $errfile, $errline) { }
set_error_handler('foobar');
function test($x) {
- global $foo;
+ global $foo;
- $x->invokeArgs(array(0));
+ $x->invokeArgs(array(0));
}
$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 arguments, 1 given
DONE
diff --git a/Zend/tests/bug46196.phpt b/Zend/tests/bug46196.phpt
index 7a6a753d87..84e26ce1a5 100644
--- a/Zend/tests/bug46196.phpt
+++ b/Zend/tests/bug46196.phpt
@@ -4,12 +4,6 @@ Test restore_error_handler() function : bug #46196
Olivier Doucet
--FILE--
<?php
-/* Prototype : void restore_error_handler(void)
- * Description: Restores the previously defined error handler function
- * Source code: Zend/zend_builtin_functions.c
- * Alias to functions:
- */
-
echo "*** Testing restore_error_handler() : error bug #46196 ***\n";
var_dump( set_error_handler( 'myErrorHandler' ) );
@@ -22,10 +16,8 @@ function myErrorHandler($errno, $errstr, $errfile, $errline)
}
?>
-===DONE===
--EXPECT--
*** Testing restore_error_handler() : error bug #46196 ***
NULL
bool(true)
NULL
-===DONE===
diff --git a/Zend/tests/bug46246.phpt b/Zend/tests/bug46246.phpt
index 12be587d74..6671c5a125 100644
--- a/Zend/tests/bug46246.phpt
+++ b/Zend/tests/bug46246.phpt
@@ -4,25 +4,25 @@ Bug #46246 (difference between call_user_func(array($this, $method)) and $this->
<?php
class A
{
- private function Test()
- {
- echo 'Hello from '.get_class($this)."\n";
- }
+ private function Test()
+ {
+ echo 'Hello from '.get_class($this)."\n";
+ }
- public function call($method, $args = array())
- {
- $this->Test();
- $this->$method();
- call_user_func(array($this, $method));
- }
+ public function call($method, $args = array())
+ {
+ $this->Test();
+ $this->$method();
+ call_user_func(array($this, $method));
+ }
}
class B extends A
{
- protected function Test()
- {
- echo 'Overridden hello from '.get_class($this)."\n";
- }
+ protected function Test()
+ {
+ echo 'Overridden hello from '.get_class($this)."\n";
+ }
}
$a = new A;
diff --git a/Zend/tests/bug46304.phpt b/Zend/tests/bug46304.phpt
index 9898838907..c456a8bbc2 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,30 +31,8 @@ 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
+Fatal error: Uncaught Error: Undefined constant "NS1\ns2\coNSt1" in %s:%d
Stack trace:
#0 {main}
thrown in %sbug46304.php on line %d
diff --git a/Zend/tests/bug46381.phpt b/Zend/tests/bug46381.phpt
index ce4e399284..db948832e6 100644
--- a/Zend/tests/bug46381.phpt
+++ b/Zend/tests/bug46381.phpt
@@ -4,9 +4,9 @@ Bug #46381 (wrong $this passed to internal methods causes segfault)
<?php
class test {
- public function method() {
- return ArrayIterator::current();
- }
+ public function method() {
+ return ArrayIterator::current();
+ }
}
$test = new test();
$test->method();
diff --git a/Zend/tests/bug46701.phpt b/Zend/tests/bug46701.phpt
index 523a96735f..5da5a9afc7 100644
--- a/Zend/tests/bug46701.phpt
+++ b/Zend/tests/bug46701.phpt
@@ -6,8 +6,8 @@ Bug #46701 (Creating associative array with long values in the key fails on 32bi
<?php
$test_array = array(
- 0xcc5c4600 => 1,
- 0xce331a00 => 2
+ 0xcc5c4600 => 1,
+ 0xce331a00 => 2
);
$test_array[0xce359000] = 3;
@@ -15,12 +15,12 @@ var_dump($test_array);
var_dump($test_array[0xce331a00]);
class foo {
- public $x;
+ public $x;
- public function __construct() {
- $this->x[0xce359000] = 3;
- var_dump($this->x);
- }
+ public function __construct() {
+ $this->x[0xce359000] = 3;
+ var_dump($this->x);
+ }
}
new foo;
diff --git a/Zend/tests/bug46813.phpt b/Zend/tests/bug46813.phpt
index b1505fc07d..321c5775b5 100644
--- a/Zend/tests/bug46813.phpt
+++ b/Zend/tests/bug46813.phpt
@@ -4,10 +4,10 @@ Bug #46813: class_exists doesn`t work with fully qualified namespace
<?php
namespace test;
{
- class inner
- {
+ class inner
+ {
- }
+ }
}
$inner = new \test\inner();
diff --git a/Zend/tests/bug47054.phpt b/Zend/tests/bug47054.phpt
index 9e89c2c208..eca13e00af 100644
--- a/Zend/tests/bug47054.phpt
+++ b/Zend/tests/bug47054.phpt
@@ -22,22 +22,8 @@ C::s();
$c = new C();
$c->s();
-get_called_class();
-
-D::m();
-
?>
---EXPECTF--
+--EXPECT--
Called class: D
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..591edfa747 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: Attempt to read property "ab" on null in %s on line %d
diff --git a/Zend/tests/bug47165.phpt b/Zend/tests/bug47165.phpt
index 2cf648d855..7f47242a1e 100644
--- a/Zend/tests/bug47165.phpt
+++ b/Zend/tests/bug47165.phpt
@@ -3,13 +3,13 @@ Bug #47165 (Possible memory corruption when passing return value by reference)
--FILE--
<?php
class Foo {
- var $bar = array();
+ var $bar = array();
- static function bar() {
- static $instance = null;
- $instance = new Foo();
- return $instance->bar;
- }
+ static function bar() {
+ static $instance = null;
+ $instance = new Foo();
+ return $instance->bar;
+ }
}
extract(Foo::bar());
echo "ok\n";
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/bug47343.phpt b/Zend/tests/bug47343.phpt
index bf1a5d2b31..f6168acf74 100644
--- a/Zend/tests/bug47343.phpt
+++ b/Zend/tests/bug47343.phpt
@@ -4,38 +4,38 @@ Bug #47343 (gc_collect_cycles causes a segfault when called within a destructor
<?php
class A
{
- public function __destruct()
- {
- gc_collect_cycles();
- }
+ public function __destruct()
+ {
+ gc_collect_cycles();
+ }
- public function getB()
- {
- $this->data['foo'] = new B($this);
- $this->data['bar'] = new B($this);
- // Return either of the above
- return $this->data['foo'];
- }
+ public function getB()
+ {
+ $this->data['foo'] = new B($this);
+ $this->data['bar'] = new B($this);
+ // Return either of the above
+ return $this->data['foo'];
+ }
}
class B
{
- public function __construct($A)
- {
- $this->A = $A;
- }
+ public function __construct($A)
+ {
+ $this->A = $A;
+ }
- public function __destruct()
- {
- }
+ public function __destruct()
+ {
+ }
}
for ($i = 0; $i < 2; $i++)
{
- $Aobj = new A;
- $Bobj = $Aobj->getB();
- unset($Bobj);
- unset($Aobj);
+ $Aobj = new A;
+ $Bobj = $Aobj->getB();
+ unset($Bobj);
+ unset($Aobj);
}
echo "DONE\n";
diff --git a/Zend/tests/bug47353.phpt b/Zend/tests/bug47353.phpt
index 189b1f51a6..de5c280e6a 100644
--- a/Zend/tests/bug47353.phpt
+++ b/Zend/tests/bug47353.phpt
@@ -5,17 +5,17 @@ Bug #47353 (crash when creating a lot of objects in object destructor)
class A
{
- function __destruct()
- {
- $myArray = array();
+ function __destruct()
+ {
+ $myArray = array();
- for($i = 1; $i <= 3000; $i++) {
- if(!isset($myArray[$i]))
- $myArray[$i] = array();
- $ref = & $myArray[$i];
- $ref[] = new stdClass();
- }
- }
+ for($i = 1; $i <= 3000; $i++) {
+ if(!isset($myArray[$i]))
+ $myArray[$i] = array();
+ $ref = & $myArray[$i];
+ $ref[] = new stdClass();
+ }
+ }
}
$a = new A();
diff --git a/Zend/tests/bug47572.phpt b/Zend/tests/bug47572.phpt
index 67bb3ec111..1e424b350c 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/bug47593.phpt b/Zend/tests/bug47593.phpt
index ffbe7c8dbb..fb3bfeab52 100644
--- a/Zend/tests/bug47593.phpt
+++ b/Zend/tests/bug47593.phpt
@@ -7,8 +7,8 @@ namespace test;
const TEST = 11;
class foo {
- public function xyz() {
- }
+ public function xyz() {
+ }
}
interface baz {
diff --git a/Zend/tests/bug47699.phpt b/Zend/tests/bug47699.phpt
index 6d4871bc2d..8c6be50199 100644
--- a/Zend/tests/bug47699.phpt
+++ b/Zend/tests/bug47699.phpt
@@ -3,9 +3,9 @@ Bug #47699 (autoload and late static binding)
--FILE--
<?php
class A {
- static function test($v='') {
- print_r(get_called_class());
- }
+ static function test($v='') {
+ print_r(get_called_class());
+ }
}
class B extends A {
}
@@ -15,7 +15,7 @@ new X();
?>
--EXPECTF--
BB
-Fatal error: Uncaught Error: Class 'X' not found in %sbug47699.php:%d
+Fatal error: Uncaught Error: Class "X" not found in %s:%d
Stack trace:
#0 {main}
thrown in %sbug47699.php 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/bug48215.phpt b/Zend/tests/bug48215.phpt
index 4582057d98..4e905df19a 100644
--- a/Zend/tests/bug48215.phpt
+++ b/Zend/tests/bug48215.phpt
@@ -4,33 +4,31 @@ Bug #48215 - parent::method() calls __construct
<?php
class A
{
- public function __construct() {
- echo __METHOD__ . "\n";
- }
- protected function A()
- {
- echo __METHOD__ . "\n";
- }
+ public function __construct() {
+ echo __METHOD__ . "\n";
+ }
+ protected function A()
+ {
+ echo __METHOD__ . "\n";
+ }
}
class B extends A
{
- public function __construct() {
- echo __METHOD__ . "\n";
- parent::__construct();
- }
- public function A()
- {
- echo __METHOD__ . "\n";
- parent::A();
- }
+ public function __construct() {
+ echo __METHOD__ . "\n";
+ parent::__construct();
+ }
+ public function A()
+ {
+ echo __METHOD__ . "\n";
+ parent::A();
+ }
}
$b = new B();
$b->A();
?>
-===DONE===
--EXPECT--
B::__construct
A::__construct
B::A
A::A
-===DONE===
diff --git a/Zend/tests/bug48215_2.phpt b/Zend/tests/bug48215_2.phpt
index 67380063c6..aa687196e1 100644
--- a/Zend/tests/bug48215_2.phpt
+++ b/Zend/tests/bug48215_2.phpt
@@ -3,14 +3,14 @@ Bug #48215 - parent::method() calls __construct, case sensitive test
--FILE--
<?php
class a {
- public function __CONSTRUCT() { echo __METHOD__ . "\n"; }
- public function a() { echo __METHOD__ . "\n"; }
+ public function __CONSTRUCT() { echo __METHOD__ . "\n"; }
+ public function a() { echo __METHOD__ . "\n"; }
}
class b extends a {}
class c extends b {
- function __construct() {
- b::b();
- }
+ function __construct() {
+ b::b();
+ }
}
$c = new c();
?>
diff --git a/Zend/tests/bug48228.phpt b/Zend/tests/bug48228.phpt
index d91ded28be..a4fa5483b9 100644
--- a/Zend/tests/bug48228.phpt
+++ b/Zend/tests/bug48228.phpt
@@ -4,19 +4,19 @@ Bug #48228 (crash when exception is thrown while passing function arguments)
<?php
function do_throw() {
- throw new Exception();
+ throw new Exception();
}
class aa
{
- function check()
- {
- }
+ function check()
+ {
+ }
- function dosome()
- {
- $this->check(do_throw());
- }
+ function dosome()
+ {
+ $this->check(do_throw());
+ }
}
$l_aa=new aa();
diff --git a/Zend/tests/bug48408.phpt b/Zend/tests/bug48408.phpt
index 3315f40962..cc34e17424 100644
--- a/Zend/tests/bug48408.phpt
+++ b/Zend/tests/bug48408.phpt
@@ -3,22 +3,22 @@ Bug #48408 (crash when exception is thrown while passing function arguments)
--FILE--
<?php
class B{
- public function process($x){
- return $x;
- }
+ public function process($x){
+ return $x;
+ }
}
class C{
- public function generate($x){
- throw new Exception;
- }
+ public function generate($x){
+ throw new Exception;
+ }
}
$b = new B;
$c = new C;
try{
- $b->process($c->generate(0));
+ $b->process($c->generate(0));
}
catch(Exception $e){
- $c->generate(0);
+ $c->generate(0);
}
?>
--EXPECTF--
diff --git a/Zend/tests/bug48409.phpt b/Zend/tests/bug48409.phpt
index 7ba99cdbf4..d05f5c42f4 100644
--- a/Zend/tests/bug48409.phpt
+++ b/Zend/tests/bug48409.phpt
@@ -7,59 +7,59 @@ class ABCException extends Exception {}
class BBB
{
- public function xyz($d, $x)
- {
- if ($x == 34) {
- throw new ABCException;
- }
- return array('foo' => 'xyz');
- }
+ public function xyz($d, $x)
+ {
+ if ($x == 34) {
+ throw new ABCException;
+ }
+ return array('foo' => 'xyz');
+ }
}
class CCC
{
- public function process($p)
- {
- return $p;
- }
+ public function process($p)
+ {
+ return $p;
+ }
}
class AAA
{
- public function func()
- {
- $b = new BBB;
- $c = new CCC;
- $i = 34;
- $item = array('foo' => 'bar');
- try {
- $c->process($b->xyz($item['foo'], $i));
- }
- catch(ABCException $e) {
- $b->xyz($item['foo'], $i);
- }
- } // end func();
+ public function func()
+ {
+ $b = new BBB;
+ $c = new CCC;
+ $i = 34;
+ $item = array('foo' => 'bar');
+ try {
+ $c->process($b->xyz($item['foo'], $i));
+ }
+ catch(ABCException $e) {
+ $b->xyz($item['foo'], $i);
+ }
+ } // end func();
}
class Runner
{
- public function run($x)
- {
- try {
- $x->func();
- }
- catch(ABCException $e) {
- throw new Exception;
- }
- }
+ public function run($x)
+ {
+ try {
+ $x->func();
+ }
+ catch(ABCException $e) {
+ throw new Exception;
+ }
+ }
}
try {
- $runner = new Runner;
- $runner->run(new AAA);
+ $runner = new Runner;
+ $runner->run(new AAA);
}
catch(Exception $e) {
- die('Exception thrown');
+ die('Exception thrown');
}
?>
diff --git a/Zend/tests/bug48428.phpt b/Zend/tests/bug48428.phpt
index ae9ac936a3..0cda84dea4 100644
--- a/Zend/tests/bug48428.phpt
+++ b/Zend/tests/bug48428.phpt
@@ -3,10 +3,10 @@ Bug #48428 (crash when exception is thrown while passing function arguments)
--FILE--
<?php
try {
- function x() { throw new Exception("ERROR"); }
- x(x());
+ function x() { throw new Exception("ERROR"); }
+ x(x());
} catch(Exception $e) {
- echo($e -> getMessage());
+ echo($e -> getMessage());
}
?>
--EXPECT--
diff --git a/Zend/tests/bug48533.phpt b/Zend/tests/bug48533.phpt
index 4fa49a2f22..39b1db9ee7 100644
--- a/Zend/tests/bug48533.phpt
+++ b/Zend/tests/bug48533.phpt
@@ -4,21 +4,21 @@ Bug #48533 (__callStatic is not invoked for private/protected methods)
<?php
class foo {
- private function a() {
- var_dump(1);
- }
- public function b() {
- var_dump(2);
- }
- protected function c() {
- var_dump(3);
- }
- static function __callstatic($a, $b) {
- var_dump('__callStatic::'. $a);
- }
- public function __call($a, $b) {
- var_dump('__call::'. $a);
- }
+ private function a() {
+ var_dump(1);
+ }
+ public function b() {
+ var_dump(2);
+ }
+ protected function c() {
+ var_dump(3);
+ }
+ static function __callstatic($a, $b) {
+ var_dump('__callStatic::'. $a);
+ }
+ public function __call($a, $b) {
+ var_dump('__call::'. $a);
+ }
}
$x = new foo;
@@ -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/bug48667_1.phpt b/Zend/tests/bug48667_1.phpt
index 2d94aed2bf..b2e4d28769 100644
--- a/Zend/tests/bug48667_1.phpt
+++ b/Zend/tests/bug48667_1.phpt
@@ -7,4 +7,4 @@ abstract class A implements Iterator, IteratorAggregate { }
?>
--EXPECTF--
-Fatal error: Class A cannot implement both IteratorAggregate and Iterator at the same time in %s on line %d
+Fatal error: Class A cannot implement both Iterator and IteratorAggregate at the same time 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/bug48770.phpt b/Zend/tests/bug48770.phpt
index 6ae972a7ab..13ff963d06 100644
--- a/Zend/tests/bug48770.phpt
+++ b/Zend/tests/bug48770.phpt
@@ -1,53 +1,34 @@
--TEST--
Bug #48770 (call_user_func_array() fails to call parent from inheriting class)
---XFAIL--
-See Bug #48770
--FILE--
<?php
class A {
- public function func($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- private function func2($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- protected function func3($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- private function func22($str) {
- var_dump(__METHOD__ .': '. $str);
- }
+ public function func($arg) {
+ echo "A::func called\n";
+ }
}
class B extends A {
- public function func($str) {
- static $avoid_crash = 0;
+ public function func($arg) {
+ echo "B::func called\n";
+ }
- if ($avoid_crash++ == 1) {
- print "This method shouldn't be called when using parent::func!\n";
- return;
- }
-
- call_user_func_array(array($this, 'parent::func'), array($str));
- }
- private function func2($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- protected function func3($str) {
- var_dump(__METHOD__ .': '. $str);
- }
+ public function callFuncInParent($arg) {
+ call_user_func_array(array($this, 'parent::func'), array($arg));
+ }
}
class C extends B {
- public function func($str) {
- parent::func($str);
- }
+ public function func($arg) {
+ echo "C::func called\n";
+ parent::func($str);
+ }
}
$c = new C;
-$c->func('This should work!');
+$c->callFuncInParent('Which function will be called??');
?>
--EXPECT--
-string(26) "A::func: This should work!"
+B::func called
diff --git a/Zend/tests/bug48770_2.phpt b/Zend/tests/bug48770_2.phpt
index d7984eac4f..de975e37a1 100644
--- a/Zend/tests/bug48770_2.phpt
+++ b/Zend/tests/bug48770_2.phpt
@@ -1,54 +1,60 @@
--TEST--
Bug #48770 (call_user_func_array() fails to call parent from inheriting class)
---XFAIL--
-See Bug #48770
--FILE--
<?php
class A {
- public function func($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- private function func2($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- protected function func3($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- private function func22($str) {
- var_dump(__METHOD__ .': '. $str);
- }
+ public function func($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
+ private function func2($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
+ protected function func3($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
+ private function func22($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
}
class B extends A {
- public function func($str) {
- call_user_func_array(array($this, 'parent::func2'), array($str));
- call_user_func_array(array($this, 'parent::func3'), array($str));
- call_user_func_array(array($this, 'parent::func22'), array($str));
- call_user_func_array(array($this, 'parent::inexistent'), array($str));
- }
- private function func2($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- protected function func3($str) {
- var_dump(__METHOD__ .': '. $str);
- }
+ public function func($str) {
+ call_user_func_array(array($this, 'parent::func2'), array($str));
+ call_user_func_array(array($this, 'parent::func3'), array($str));
+
+ try {
+ call_user_func_array(array($this, 'parent::func22'), array($str));
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+
+ try {
+ call_user_func_array(array($this, 'parent::inexistent'), array($str));
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ }
+ private function func2($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
+ protected function func3($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
}
class C extends B {
- public function func($str) {
- parent::func($str);
- }
+ public function func($str) {
+ parent::func($str);
+ }
}
$c = new C;
$c->func('This should work!');
?>
---EXPECTF--
-string(27) "A::func2: This should work!"
-string(27) "A::func3: This should work!"
-
-Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method A::func22() in %s on line %d
-
-Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'A' does not have a method 'inexistent' in %s on line %d
+--EXPECT--
+string(27) "B::func2: This should work!"
+string(27) "B::func3: This should work!"
+call_user_func_array(): Argument #1 ($function) must be a valid callback, cannot access private method B::func22()
+call_user_func_array(): Argument #1 ($function) must be a valid callback, class B does not have a method "inexistent"
diff --git a/Zend/tests/bug48770_3.phpt b/Zend/tests/bug48770_3.phpt
index 5c6eacb470..0918755b72 100644
--- a/Zend/tests/bug48770_3.phpt
+++ b/Zend/tests/bug48770_3.phpt
@@ -1,51 +1,50 @@
--TEST--
Bug #48770 (call_user_func_array() fails to call parent from inheriting class)
---XFAIL--
-See Bug #48770
--FILE--
<?php
class A {
- public function func($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- private function func2($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- protected function func3($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- private function func22($str) {
- var_dump(__METHOD__ .': '. $str);
- }
+ public function func($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
+ private function func2($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
+ protected function func3($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
}
class B extends A {
- public function func($str) {
- call_user_func_array(array($this, 'self::func2'), array($str));
- call_user_func_array(array($this, 'self::func3'), array($str));
- call_user_func_array(array($this, 'self::inexistent'), array($str));
- }
- private function func2($str) {
- var_dump(__METHOD__ .': '. $str);
- }
- protected function func3($str) {
- var_dump(__METHOD__ .': '. $str);
- }
+ public function func($str) {
+ call_user_func_array(array($this, 'self::func2'), array($str));
+ call_user_func_array(array($this, 'self::func3'), array($str));
+
+ try {
+ call_user_func_array(array($this, 'self::inexistent'), array($str));
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ }
+ private function func2($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
+ protected function func3($str) {
+ var_dump(__METHOD__ .': '. $str);
+ }
}
class C extends B {
- public function func($str) {
- parent::func($str);
- }
+ public function func($str) {
+ parent::func($str);
+ }
}
$c = new C;
$c->func('This should work!');
?>
---EXPECTF--
+--EXPECT--
string(27) "B::func2: This should work!"
string(27) "B::func3: This should work!"
-
-Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'B' does not have a method 'inexistent' in %s on line %d
+call_user_func_array(): Argument #1 ($function) must be a valid callback, class C does not have a method "inexistent"
diff --git a/Zend/tests/bug48899.phpt b/Zend/tests/bug48899.phpt
index ff640543cb..2cbf308c3e 100644
--- a/Zend/tests/bug48899.phpt
+++ b/Zend/tests/bug48899.phpt
@@ -6,12 +6,12 @@ Bug #48899 (is_callable returns true even if method does not exist in parent cla
class ParentClass { }
class ChildClass extends ParentClass {
- public function testIsCallable() {
- var_dump(is_callable(array($this, 'parent::testIsCallable')));
- }
- public function testIsCallable2() {
- var_dump(is_callable(array($this, 'static::testIsCallable2')));
- }
+ public function testIsCallable() {
+ var_dump(is_callable(array($this, 'parent::testIsCallable')));
+ }
+ public function testIsCallable2() {
+ var_dump(is_callable(array($this, 'static::testIsCallable2')));
+ }
}
$child = new ChildClass();
diff --git a/Zend/tests/bug48912.phpt b/Zend/tests/bug48912.phpt
index dc021a2efc..b2cee06bf1 100644
--- a/Zend/tests/bug48912.phpt
+++ b/Zend/tests/bug48912.phpt
@@ -6,7 +6,7 @@ namespace A;
function test()
{
- extract(func_get_arg(0));
+ extract(func_get_arg(0));
}
test(array('x' => 1));
diff --git a/Zend/tests/bug49472.phpt b/Zend/tests/bug49472.phpt
index 2d7ae514f2..e5b21fd500 100644
--- a/Zend/tests/bug49472.phpt
+++ b/Zend/tests/bug49472.phpt
@@ -12,12 +12,12 @@ class Foo implements ia {
}
class FooBar extends Foo implements ia {
- const x = 1;
- const c = 'Ocean';
+ const x = 1;
+ const c = 'Ocean';
- public function show() {
- return ia::c;
- }
+ public function show() {
+ return ia::c;
+ }
}
new FooBar;
diff --git a/Zend/tests/bug49866.phpt b/Zend/tests/bug49866.phpt
index 0b7c224c01..f1df42d5c2 100644
--- a/Zend/tests/bug49866.phpt
+++ b/Zend/tests/bug49866.phpt
@@ -6,6 +6,7 @@ $a = "string";
$b = &$a[1];
$b = "f";
echo $a;
+?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sbug49866.php:3
Stack trace:
diff --git a/Zend/tests/bug49893.phpt b/Zend/tests/bug49893.phpt
index addf447073..adab4421dd 100644
--- a/Zend/tests/bug49893.phpt
+++ b/Zend/tests/bug49893.phpt
@@ -3,24 +3,24 @@ Bug #49893 (Crash while creating an instance of Zend_Mail_Storage_Pop3)
--FILE--
<?php
class A {
- function __destruct() {
- try {
- throw new Exception("2");
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- }
+ function __destruct() {
+ try {
+ throw new Exception("2");
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ }
}
class B {
- function __construct() {
- $this->a = new A();
- throw new Exception("1");
- }
+ function __construct() {
+ $this->a = new A();
+ throw new Exception("1");
+ }
}
try {
- $b = new B();
+ $b = new B();
} catch(Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/bug49908.phpt b/Zend/tests/bug49908.phpt
index e3e91d3452..e545a0858c 100644
--- a/Zend/tests/bug49908.phpt
+++ b/Zend/tests/bug49908.phpt
@@ -1,16 +1,16 @@
--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
spl_autoload_register(function ($className) {
- var_dump($className);
+ var_dump($className);
- if ($className == 'Foo') {
- class Foo implements Bar {};
- } else {
- throw new Exception($className);
- }
+ if ($className == 'Foo') {
+ class Foo implements Bar {};
+ } else {
+ throw new Exception($className);
+ }
});
try {
@@ -29,9 +29,7 @@ string(3) "Bar"
Fatal error: Uncaught Exception: Bar in %s:%d
Stack trace:
-#0 [internal function]: {closure}('Bar')
-#1 %s(%d): spl_autoload_call('Bar')
-#2 [internal function]: {closure}('Foo')
-#3 %s(%d): spl_autoload_call('Foo')
-#4 {main}
+#0 %s(%d): {closure}('Bar')
+#1 %s(%d): {closure}('Foo')
+#2 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug50005.phpt b/Zend/tests/bug50005.phpt
index 2ed055a129..8b3817cd5f 100644
--- a/Zend/tests/bug50005.phpt
+++ b/Zend/tests/bug50005.phpt
@@ -4,9 +4,9 @@ Bug #50005 (Throwing through Reflection modified Exception object makes segmenta
<?php
class a extends exception {
- public function __construct() {
- $this->file = null;
- }
+ public function __construct() {
+ $this->file = null;
+ }
}
throw new a;
diff --git a/Zend/tests/bug50174.phpt b/Zend/tests/bug50174.phpt
index 6ed5733b67..5f0bbd7dd4 100644
--- a/Zend/tests/bug50174.phpt
+++ b/Zend/tests/bug50174.phpt
@@ -5,10 +5,10 @@ Bug #50174 (Incorrectly matched docComment)
class TestClass
{
- /** const comment */
- const C = 0;
+ /** const comment */
+ const C = 0;
- function x() {}
+ function x() {}
}
$rm = new ReflectionMethod('TestClass', 'x');
@@ -16,10 +16,10 @@ var_dump($rm->getDocComment());
class TestClass2
{
- /** const comment */
- const C = 0;
+ /** const comment */
+ const C = 0;
- public $x;
+ public $x;
}
$rp = new ReflectionProperty('TestClass2', 'x');
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/bug50383.phpt b/Zend/tests/bug50383.phpt
index de81facd05..2f72ea51f8 100644
--- a/Zend/tests/bug50383.phpt
+++ b/Zend/tests/bug50383.phpt
@@ -4,34 +4,34 @@ Bug #50383 (Exceptions thrown in __call / __callStatic do not include file and l
<?php
class myClass {
- public static function __callStatic($method, $args) {
- throw new Exception("Missing static method '$method'\n");
- }
- public function __call($method, $args) {
- throw new Exception("Missing method '$method'\n");
- }
+ public static function __callStatic($method, $args) {
+ throw new Exception("Missing static method '$method'\n");
+ }
+ public function __call($method, $args) {
+ throw new Exception("Missing method '$method'\n");
+ }
}
function thrower() {
- myClass::ThrowException();
+ myClass::ThrowException();
}
function thrower2() {
- $x = new myClass;
- $x->foo();
+ $x = new myClass;
+ $x->foo();
}
try {
- thrower();
+ thrower();
} catch(Exception $e) {
- print $e->getMessage();
- print_r($e->getTrace());
+ print $e->getMessage();
+ print_r($e->getTrace());
}
try {
- thrower2();
+ thrower2();
} catch (Exception $e) {
- print $e->getMessage();
- print_r($e->getTrace());
+ print $e->getMessage();
+ print_r($e->getTrace());
}
?>
diff --git a/Zend/tests/bug50394.phpt b/Zend/tests/bug50394.phpt
index 60b9d34582..ef8b79828d 100644
--- a/Zend/tests/bug50394.phpt
+++ b/Zend/tests/bug50394.phpt
@@ -6,7 +6,7 @@ function inc( &$x ) { $x++; }
class Proxy {
function __call( $name, $args ) {
- echo "$name called!\n";
+ echo "$name called!\n";
call_user_func_array( 'inc', $args );
}
}
@@ -17,6 +17,7 @@ $proxy = new Proxy;
call_user_func_array( array( $proxy, 'bar' ), $args );
call_user_func_array( array( $proxy, 'bar' ), array(&$arg) );
var_dump($arg);
+?>
--EXPECT--
bar called!
bar called!
diff --git a/Zend/tests/bug50816.phpt b/Zend/tests/bug50816.phpt
index 98a89380c3..f9f11b5849 100644
--- a/Zend/tests/bug50816.phpt
+++ b/Zend/tests/bug50816.phpt
@@ -35,6 +35,7 @@ var_dump($mapWithoutConst0[1]);
var_dump($mapWithoutConst1[1]);
var_dump($mapWithoutConst2[1]);
var_dump($mapWithoutConst3[1]);
+?>
--EXPECT--
string(3) "two"
string(3) "two"
diff --git a/Zend/tests/bug51176.phpt b/Zend/tests/bug51176.phpt
index c5185cc5fa..cf47b74da8 100644
--- a/Zend/tests/bug51176.phpt
+++ b/Zend/tests/bug51176.phpt
@@ -4,22 +4,22 @@ Bug #51176 (Static calling in non-static method behaves like $this->)
<?php
class Foo
{
- public function start()
- {
- self::bar();
- static::bar();
- Foo::bar();
- }
+ public function start()
+ {
+ self::bar();
+ static::bar();
+ Foo::bar();
+ }
- public function __call($n, $a)
- {
- echo "instance\n";
- }
+ public function __call($n, $a)
+ {
+ echo "instance\n";
+ }
- public static function __callStatic($n, $a)
- {
- echo "static\n";
- }
+ public static function __callStatic($n, $a)
+ {
+ echo "static\n";
+ }
}
$foo = new Foo();
diff --git a/Zend/tests/bug51394.phpt b/Zend/tests/bug51394.phpt
index e2d260b2b2..629ebec622 100644
--- a/Zend/tests/bug51394.phpt
+++ b/Zend/tests/bug51394.phpt
@@ -6,15 +6,16 @@ error_reporting=-1
<?php
function eh()
{
- throw new Exception("error!");
- return false;
+ throw new Exception("error!");
+ return false;
}
set_error_handler("eh");
$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/bug51421.phpt b/Zend/tests/bug51421.phpt
index bc1758c300..f6daf1eae7 100644
--- a/Zend/tests/bug51421.phpt
+++ b/Zend/tests/bug51421.phpt
@@ -6,11 +6,11 @@ Bug #51421 (Abstract __construct constructor argument list not enforced)
class ExampleClass {}
abstract class TestInterface {
- abstract public function __construct(ExampleClass $var);
+ abstract public function __construct(ExampleClass $var);
}
class Test extends TestInterface {
- public function __construct() {}
+ public function __construct() {}
}
?>
diff --git a/Zend/tests/bug51791.phpt b/Zend/tests/bug51791.phpt
index 0b92fa8c62..7675cb564d 100644
--- a/Zend/tests/bug51791.phpt
+++ b/Zend/tests/bug51791.phpt
@@ -6,9 +6,12 @@ Bug #51791 (constant() failed to check undefined constant and php interpreter st
class A {
const B = 1;
}
-var_dump(constant('A::B1'));
+try {
+ constant('A::B1');
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: constant(): Couldn't find constant A::B1 in %s on line %d
-NULL
+--EXPECT--
+Undefined constant A::B1
diff --git a/Zend/tests/bug51822.phpt b/Zend/tests/bug51822.phpt
index c097395283..0a3813b2f1 100644
--- a/Zend/tests/bug51822.phpt
+++ b/Zend/tests/bug51822.phpt
@@ -4,24 +4,24 @@ Bug #51822 (Segfault with strange __destruct() for static class variables)
<?php
class DestructableObject
{
- public function __destruct()
- {
- echo "2\n";
- }
+ public function __destruct()
+ {
+ echo "2\n";
+ }
}
class DestructorCreator
{
- public function __destruct()
- {
- $this->test = new DestructableObject;
- echo "1\n";
- }
+ public function __destruct()
+ {
+ $this->test = new DestructableObject;
+ echo "1\n";
+ }
}
class Test
{
- public static $mystatic;
+ public static $mystatic;
}
// Uncomment this to avoid segfault
@@ -30,7 +30,7 @@ class Test
$x = new Test();
if (!isset(Test::$mystatic))
- Test::$mystatic = new DestructorCreator();
+ Test::$mystatic = new DestructorCreator();
echo "bla\n";
?>
diff --git a/Zend/tests/bug51827.phpt b/Zend/tests/bug51827.phpt
index 0834749454..1b91345e34 100644
--- a/Zend/tests/bug51827.phpt
+++ b/Zend/tests/bug51827.phpt
@@ -5,7 +5,7 @@ Bug #51827 (Bad warning when register_shutdown_function called with wrong num of
function abc() {
- var_dump(1);
+ var_dump(1);
}
register_shutdown_function('timE');
@@ -13,7 +13,11 @@ register_shutdown_function('ABC');
register_shutdown_function('exploDe');
?>
---EXPECTF--
+--EXPECT--
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 arguments, 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..b473157511 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..7debab3f8b 100644
--- a/Zend/tests/bug52041.phpt
+++ b/Zend/tests/bug52041.phpt
@@ -3,15 +3,39 @@ Bug #52041 (Memory leak when writing on uninitialized variable returned from fun
--FILE--
<?php
function foo() {
- return $x;
+ 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" on null
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable $x in %s on line %d
+Attempt to modify property "a" on null
-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" on null
-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" on null
-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" on null
-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" on null
-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
+Warning: Undefined array key 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
+Warning: Undefined array key 0 in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 16
+Warning: Undefined array key 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
+Warning: Undefined array key 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
+Warning: Undefined array key 0 in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 18
+Warning: Undefined array key 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/bug52193.phpt b/Zend/tests/bug52193.phpt
index 7452672e31..12b9868bcc 100644
--- a/Zend/tests/bug52193.phpt
+++ b/Zend/tests/bug52193.phpt
@@ -10,7 +10,7 @@ var_dump($h = (array) function () { return 2; });
var_dump($h[0]());
$i = function () use (&$h) {
- return $h;
+ return $h;
};
var_dump($x = (array)$i);
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/bug52355.phpt b/Zend/tests/bug52355.phpt
index 7f46c71d46..0c207be2be 100644
--- a/Zend/tests/bug52355.phpt
+++ b/Zend/tests/bug52355.phpt
@@ -10,11 +10,15 @@ $foo = -sin(0);
var_dump($foo);
-var_dump(@(1.0 / -0.0));
+try {
+ var_dump(1.0 / -0.0);
+} catch (\DivisionByZeroError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
--EXPECT--
float(-0)
float(-0)
float(-0)
-float(-INF)
+Division by zero
diff --git a/Zend/tests/bug52361.phpt b/Zend/tests/bug52361.phpt
index 5ffe569e4a..1937fee020 100644
--- a/Zend/tests/bug52361.phpt
+++ b/Zend/tests/bug52361.phpt
@@ -3,23 +3,23 @@ Bug #52361 (Throwing an exception in a destructor causes invalid catching)
--FILE--
<?php
class aaa {
- public function __destruct() {
- try {
- throw new Exception(__CLASS__);
- } catch(Exception $ex) {
- echo "1. $ex\n";
- }
- }
+ public function __destruct() {
+ try {
+ throw new Exception(__CLASS__);
+ } catch(Exception $ex) {
+ echo "1. $ex\n";
+ }
+ }
}
function bbb() {
- $a = new aaa();
- throw new Exception(__FUNCTION__);
+ $a = new aaa();
+ throw new Exception(__FUNCTION__);
}
try {
- bbb();
- echo "must be skipped !!!";
+ bbb();
+ echo "must be skipped !!!";
} catch(Exception $ex) {
- echo "2. $ex\n";
+ echo "2. $ex\n";
}
?>
--EXPECTF--
diff --git a/Zend/tests/bug52484.phpt b/Zend/tests/bug52484.phpt
index b8202a4504..9b74facc58 100644
--- a/Zend/tests/bug52484.phpt
+++ b/Zend/tests/bug52484.phpt
@@ -4,9 +4,9 @@ Bug #52484 (__set() ignores setting properties with empty names)
<?php
class A {
- function __unset($prop) {
- unset($this->$prop);
- }
+ function __unset($prop) {
+ unset($this->$prop);
+ }
}
$a = new A();
@@ -16,7 +16,7 @@ unset($a->$prop);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot access property started with '\0' in %s:%d
+Fatal error: Uncaught Error: Cannot access property starting with "\0" in %s:%d
Stack trace:
#0 %s(%d): A->__unset('\x00')
#1 {main}
diff --git a/Zend/tests/bug52484_2.phpt b/Zend/tests/bug52484_2.phpt
index 3b12950c66..9b96d767e8 100644
--- a/Zend/tests/bug52484_2.phpt
+++ b/Zend/tests/bug52484_2.phpt
@@ -4,9 +4,9 @@ Bug #52484.2 (__set() ignores setting properties with empty names)
<?php
class A {
- function __set($prop, $val) {
- $this->$prop = $val;
- }
+ function __set($prop, $val) {
+ $this->$prop = $val;
+ }
}
$a = new A();
@@ -16,7 +16,7 @@ $a->$prop = 2;
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot access property started with '\0' in %s:%d
+Fatal error: Uncaught Error: Cannot access property starting with "\0" in %s:%d
Stack trace:
#0 %s(%d): A->__set('\x00', 2)
#1 {main}
diff --git a/Zend/tests/bug52484_3.phpt b/Zend/tests/bug52484_3.phpt
index 995e624dfc..9cf9be8139 100644
--- a/Zend/tests/bug52484_3.phpt
+++ b/Zend/tests/bug52484_3.phpt
@@ -4,9 +4,9 @@ Bug #52484.3 (__set() ignores setting properties with empty names)
<?php
class A {
- function __get($prop) {
- var_dump($this->$prop);
- }
+ function __get($prop) {
+ var_dump($this->$prop);
+ }
}
$a = new A();
@@ -16,7 +16,7 @@ var_dump($a->$prop);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot access property started with '\0' in %s:%d
+Fatal error: Uncaught Error: Cannot access property starting with "\0" in %s:%d
Stack trace:
#0 %s(%d): A->__get('\x00')
#1 {main}
diff --git a/Zend/tests/bug52614.phpt b/Zend/tests/bug52614.phpt
index 0a1dca6882..8c2bc0dc9e 100644
--- a/Zend/tests/bug52614.phpt
+++ b/Zend/tests/bug52614.phpt
@@ -3,41 +3,41 @@ Bug #52614 (Memory leak when writing on uninitialized variable returned from met
--FILE--
<?php
class foo {
- public $a1;
- public $a2 = array();
- public $a3;
- public $o1;
- public $o2;
-
- public function f1() {
- return $this->a1;
- }
-
- public function f2() {
- return $this->a2;
- }
-
- public function f3() {
- $this->a3 = array();
- return $this->a3;
- }
-
- public function f4() {
- return $this->o1;
- }
-
- public function f5() {
- $this->o2 = new stdClass;
- return $this->o2;
- }
-
- public function &f6() {
- return $this->a1;
- }
-
- public function f7(&$x) {
- $x = 2;
- }
+ public $a1;
+ public $a2 = array();
+ public $a3;
+ public $o1;
+ public $o2;
+
+ public function f1() {
+ return $this->a1;
+ }
+
+ public function f2() {
+ return $this->a2;
+ }
+
+ public function f3() {
+ $this->a3 = array();
+ return $this->a3;
+ }
+
+ public function f4() {
+ return $this->o1;
+ }
+
+ public function f5() {
+ $this->o2 = new stdClass;
+ return $this->o2;
+ }
+
+ public function &f6() {
+ return $this->a1;
+ }
+
+ public function f7(&$x) {
+ $x = 2;
+ }
}
@@ -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,16 @@ $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" on null
NULL
-object(stdClass)#%d (1) {
+object(stdClass)#3 (1) {
["a"]=>
int(1)
}
diff --git a/Zend/tests/bug52879.phpt b/Zend/tests/bug52879.phpt
index 6c3232f32d..3489a2afbc 100644
--- a/Zend/tests/bug52879.phpt
+++ b/Zend/tests/bug52879.phpt
@@ -3,14 +3,15 @@ Bug #52879 (Objects unreferenced in __get, __set, __isset or __unset can be free
--FILE--
<?php
class MyClass {
- public $myRef;
- public function __set($property,$value) {
- $this->myRef = $value;
- }
+ public $myRef;
+ public function __set($property,$value) {
+ $this->myRef = $value;
+ }
}
$myGlobal=new MyClass();
$myGlobal->myRef=&$myGlobal;
$myGlobal->myNonExistentProperty="ok\n";
echo $myGlobal;
+?>
--EXPECT--
ok
diff --git a/Zend/tests/bug52940.phpt b/Zend/tests/bug52940.phpt
index 51137c091e..a3a130619f 100644
--- a/Zend/tests/bug52940.phpt
+++ b/Zend/tests/bug52940.phpt
@@ -3,8 +3,8 @@ Bug #52940 (call_user_func_array still allows call-time pass-by-reference)
--FILE--
<?php
function foo($a) {
- $a++;
- var_dump($a);
+ $a++;
+ var_dump($a);
}
function bar(&$a) {
$a++;
diff --git a/Zend/tests/bug53305.phpt b/Zend/tests/bug53305.phpt
index c922ac6338..c76b582e24 100644
--- a/Zend/tests/bug53305.phpt
+++ b/Zend/tests/bug53305.phpt
@@ -14,6 +14,6 @@ var_dump(constant('__COMPILER_HALT_OFFSET__1'.chr(0)));
?>
--EXPECTF--
-Notice: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d
+Warning: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d
int(1)
int(4)
diff --git a/Zend/tests/bug53432.phpt b/Zend/tests/bug53432.phpt
index 83df599313..fb6b80857a 100644
--- a/Zend/tests/bug53432.phpt
+++ b/Zend/tests/bug53432.phpt
@@ -16,7 +16,11 @@ var_dump($str[-1] = 'a');
var_dump($str);
$str = '';
-var_dump($str['foo'] = 'a');
+try {
+ var_dump($str['foo'] = 'a');
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump($str);
$str = '';
@@ -50,12 +54,10 @@ string(1) "a"
string(1) "a"
string(6) " a"
-Warning: Illegal string offset: -1 in %s on line %d
+Warning: Illegal string offset -1 in %s on line %d
NULL
string(0) ""
-
-Warning: Illegal string offset 'foo' in %s on line %d
-string(1) "a"
+Cannot access offset of type string on string
string(1) "a"
Error: [] operator not supported for strings
string(0) ""
diff --git a/Zend/tests/bug53511.phpt b/Zend/tests/bug53511.phpt
index 583df3c258..b07504506a 100644
--- a/Zend/tests/bug53511.phpt
+++ b/Zend/tests/bug53511.phpt
@@ -3,22 +3,23 @@ Bug #53511 (Exceptions are lost in case an exception is thrown in catch operator
--FILE--
<?php
class Foo {
- function __destruct() {
- throw new Exception("ops 1");
- }
+ function __destruct() {
+ throw new Exception("ops 1");
+ }
}
function test() {
- $e = new Foo();
- try {
- throw new Exception("ops 2");
- } catch (Exception $e) {
- echo $e->getMessage()."\n";
- }
+ $e = new Foo();
+ try {
+ throw new Exception("ops 2");
+ } catch (Exception $e) {
+ echo $e->getMessage()."\n";
+ }
}
test();
echo "bug\n";
+?>
--EXPECTF--
Fatal error: Uncaught Exception: ops 1 in %sbug53511.php:4
Stack trace:
diff --git a/Zend/tests/bug53727.phpt b/Zend/tests/bug53727.phpt
index 22cd5232c7..6e3500bdcb 100644
--- a/Zend/tests/bug53727.phpt
+++ b/Zend/tests/bug53727.phpt
@@ -15,6 +15,7 @@ echo (defined('ChildClass::TEST_CONSTANT') ? 'true' : 'false') . "\n";
echo (is_subclass_of('ParentClass', 'MyInterface') ? 'true' : 'false') . "\n";
echo (defined('ParentClass::TEST_CONSTANT') ? 'true' : 'false') . "\n";
+?>
--EXPECT--
true
true
diff --git a/Zend/tests/bug54039.phpt b/Zend/tests/bug54039.phpt
index ccdfe94305..3531b6efb8 100644
--- a/Zend/tests/bug54039.phpt
+++ b/Zend/tests/bug54039.phpt
@@ -3,44 +3,45 @@ Bug #54039 (use() of static variables in lambda functions can break staticness)
--FILE--
<?php
function test_1() {
- static $v = 0;
- ++$v;
- echo "Outer function increments \$v to $v\n";
- $f = function() use($v) {
- echo "Inner function reckons \$v is $v\n";
- };
- return $f;
+ static $v = 0;
+ ++$v;
+ echo "Outer function increments \$v to $v\n";
+ $f = function() use($v) {
+ echo "Inner function reckons \$v is $v\n";
+ };
+ return $f;
}
$f = test_1(); $f();
$f = test_1(); $f();
function test_2() {
- static $v = 0;
- $f = function() use($v) {
- echo "Inner function reckons \$v is $v\n";
- };
- ++$v;
- echo "Outer function increments \$v to $v\n";
- return $f;
+ static $v = 0;
+ $f = function() use($v) {
+ echo "Inner function reckons \$v is $v\n";
+ };
+ ++$v;
+ echo "Outer function increments \$v to $v\n";
+ return $f;
}
$f = test_2(); $f();
$f = test_2(); $f();
function test_3() {
- static $v = "";
- $v .= 'b';
- echo "Outer function catenates 'b' onto \$v to give $v\n";
- $f = function() use($v) {
- echo "Inner function reckons \$v is $v\n";
- };
- $v .= 'a';
- echo "Outer function catenates 'a' onto \$v to give $v\n";
- return $f;
+ static $v = "";
+ $v .= 'b';
+ echo "Outer function catenates 'b' onto \$v to give $v\n";
+ $f = function() use($v) {
+ echo "Inner function reckons \$v is $v\n";
+ };
+ $v .= 'a';
+ echo "Outer function catenates 'a' onto \$v to give $v\n";
+ return $f;
}
$f = test_3(); $f();
$f = test_3(); $f();
+?>
--EXPECT--
Outer function increments $v to 1
Inner function reckons $v is 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/bug54268.phpt b/Zend/tests/bug54268.phpt
index b544cd882a..e4ce5c0e3a 100644
--- a/Zend/tests/bug54268.phpt
+++ b/Zend/tests/bug54268.phpt
@@ -6,7 +6,7 @@ memory_limit=8M
<?php
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
if ($zend_mm_enabled === "0") {
- die("skip Zend MM disabled");
+ die("skip Zend MM disabled");
}
?>
--FILE--
@@ -31,5 +31,6 @@ class Test
}
$x = new Test();
Test::$mystatic = new DestructorCreator();
+?>
--EXPECTF--
Fatal error: Allowed memory size of %s bytes exhausted%s(tried to allocate %s bytes) in %s on line %d
diff --git a/Zend/tests/bug54305.phpt b/Zend/tests/bug54305.phpt
index 8e85d2be58..61e351306f 100644
--- a/Zend/tests/bug54305.phpt
+++ b/Zend/tests/bug54305.phpt
@@ -9,14 +9,11 @@ class TestClass {
abstract class AbstractClass {
}
$methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs');
-echo $methodWithArgs++;
-?>
---EXPECTF--
-Method [ <user> public method methodWithArgs ] {
- @@ %sbug54305.php %d - %d
-
- - Parameters [2] {
- Parameter #0 [ <required> $a ]
- Parameter #1 [ <required> $b ]
- }
+try {
+ echo $methodWithArgs++;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
+?>
+--EXPECT--
+Cannot increment ReflectionMethod
diff --git a/Zend/tests/bug54358.phpt b/Zend/tests/bug54358.phpt
index faeeeacc55..28d8edb4fd 100644
--- a/Zend/tests/bug54358.phpt
+++ b/Zend/tests/bug54358.phpt
@@ -3,8 +3,8 @@ Bug #54358 (Closure, use and reference)
--FILE--
<?php
class asserter {
- public function call($function) {
- }
+ public function call($function) {
+ }
}
$asserter = new asserter();
diff --git a/Zend/tests/bug54367.phpt b/Zend/tests/bug54367.phpt
index 1ca6ad4252..e926b8937e 100644
--- a/Zend/tests/bug54367.phpt
+++ b/Zend/tests/bug54367.phpt
@@ -10,7 +10,7 @@ class MyObjet implements ArrayAccess
public function offsetGet ($offset)
{
- return function ($var) use ($offset) { // here is the problem
+ return function ($var) use ($offset) { // here is the problem
var_dump($offset, $var);
};
}
diff --git a/Zend/tests/bug54547.phpt b/Zend/tests/bug54547.phpt
index 452cbb8a53..2f6387ca26 100644
--- a/Zend/tests/bug54547.phpt
+++ b/Zend/tests/bug54547.phpt
@@ -3,7 +3,7 @@ Bug #54547: wrong equality of string numbers near LONG_MAX with 64-bit longs
--SKIPIF--
<?php
if (PHP_INT_MAX !== 9223372036854775807)
- die("skip for 64-bit long systems only");
+ die("skip for 64-bit long systems only");
--FILE--
<?php
var_dump("9223372036854775807" == "9223372036854775808");
@@ -13,6 +13,7 @@ var_dump("0x7fffffffffffffff" == "9223372036854775808");
/* not exactly what the bug is about, but closely related problem: */
var_dump("999223372036854775807"=="999223372036854775808");
var_dump("899223372036854775807">"00999223372036854775807");
+?>
--EXPECT--
bool(false)
bool(false)
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/bug54624.phpt b/Zend/tests/bug54624.phpt
index 66239120a4..883c60ff80 100644
--- a/Zend/tests/bug54624.phpt
+++ b/Zend/tests/bug54624.phpt
@@ -4,20 +4,20 @@ Bug #54624 (class_alias and type hint)
<?php
class A
{
- function foo(A $param) {
- }
+ function foo(A $param) {
+ }
}
class_alias('A', 'AliasA');
-eval('
- class B extends A
- {
- function foo(AliasA $param) {
- }
+eval('
+ class B extends A
+ {
+ function foo(AliasA $param) {
+ }
- }
+ }
');
echo "DONE\n";
diff --git a/Zend/tests/bug54910.phpt b/Zend/tests/bug54910.phpt
index a63f10fa7f..c8317a1708 100644
--- a/Zend/tests/bug54910.phpt
+++ b/Zend/tests/bug54910.phpt
@@ -24,5 +24,6 @@ class B extends A {}
$input = new B();
echo $input->getEmail();
+?>
--EXPECT--
No such method - 'noSuchMethod'
diff --git a/Zend/tests/bug55086.phpt b/Zend/tests/bug55086.phpt
index 2c89837855..10be0d1ef5 100644
--- a/Zend/tests/bug55086.phpt
+++ b/Zend/tests/bug55086.phpt
@@ -26,7 +26,7 @@ namespace N2 {
echo $a->hello(), PHP_EOL;
echo $a->foo(), PHP_EOL;
try {
- } catch(namespace\Foo $e)
+ } catch (namespace\Foo $e)
{
}
}
diff --git a/Zend/tests/bug55156.phpt b/Zend/tests/bug55156.phpt
index 53cdf1337a..2dc47a1134 100644
--- a/Zend/tests/bug55156.phpt
+++ b/Zend/tests/bug55156.phpt
@@ -7,22 +7,22 @@ opcache.save_comments=1
/** test */
namespace foo {
- function test() { }
+ function test() { }
- $x = new \ReflectionFunction('foo\test');
- var_dump($x->getDocComment());
+ $x = new \ReflectionFunction('foo\test');
+ var_dump($x->getDocComment());
- /** test1 */
- class bar { }
+ /** test1 */
+ class bar { }
- /** test2 */
- class foo extends namespace\bar { }
+ /** test2 */
+ class foo extends namespace\bar { }
- $x = new \ReflectionClass('foo\bar');
- var_dump($x->getDocComment());
+ $x = new \ReflectionClass('foo\bar');
+ var_dump($x->getDocComment());
- $x = new \ReflectionClass('foo\foo');
- var_dump($x->getDocComment());
+ $x = new \ReflectionClass('foo\foo');
+ var_dump($x->getDocComment());
}
?>
diff --git a/Zend/tests/bug55247.phpt b/Zend/tests/bug55247.phpt
index 8c21019abd..c87fcb9526 100644
--- a/Zend/tests/bug55247.phpt
+++ b/Zend/tests/bug55247.phpt
@@ -4,11 +4,11 @@ Request #55247 (Parser problem with static calls using string method name)
<?php
class Test{
public static function __callStatic($method, $arguments)
- {
+ {
echo $method . PHP_EOL;
}
public function __call($method, $arguments)
- {
+ {
echo $method . PHP_EOL;
}
}
@@ -24,6 +24,7 @@ $test->{'method'}();
Test::method();
Test::$method();
Test::{'method'}();
+?>
--EXPECT--
method
method
diff --git a/Zend/tests/bug55578.phpt b/Zend/tests/bug55578.phpt
index b67d3824e0..79bd0c75ab 100644
--- a/Zend/tests/bug55578.phpt
+++ b/Zend/tests/bug55578.phpt
@@ -11,7 +11,7 @@ class Foo {
}
function test($options, $queryPart) {
- return ''. (0 ? 1 : $queryPart);
+ return ''. (0 ? 1 : $queryPart);
}
var_dump(test($options, new Foo()));
diff --git a/Zend/tests/bug55825.phpt b/Zend/tests/bug55825.phpt
index 23fc933ee6..eb4dafc96d 100644
--- a/Zend/tests/bug55825.phpt
+++ b/Zend/tests/bug55825.phpt
@@ -3,15 +3,16 @@ Bug #55825 (Missing initial value of static locals in trait methods)
--FILE--
<?php
trait T1 {
- public function inc() {
- static $x=1;
- echo $x++ . "\n";
- }
+ public function inc() {
+ static $x=1;
+ echo $x++ . "\n";
+ }
}
class C { use T1; }
$c1 = new C;
$c1->inc();
$c1->inc();
+?>
--EXPECT--
1
2
diff --git a/Zend/tests/bug60099.phpt b/Zend/tests/bug60099.phpt
index 8cca3440fb..fbb5e85fb7 100644
--- a/Zend/tests/bug60099.phpt
+++ b/Zend/tests/bug60099.phpt
@@ -3,8 +3,8 @@ Bug #60099 (__halt_compiler() works in braced namespaces)
--FILE--
<?php
namespace foo {
- __halt_compiler();
+ __halt_compiler();
?>
--EXPECTF--
-Parse error: syntax error, unexpected end of file in %s on line %d
+Parse error: Unclosed '{' on line 2 in %s on line %d
diff --git a/Zend/tests/bug60169.phpt b/Zend/tests/bug60169.phpt
index f97574191c..f24c7cb564 100644
--- a/Zend/tests/bug60169.phpt
+++ b/Zend/tests/bug60169.phpt
@@ -7,5 +7,6 @@ $arr = array("test");
list($a,$b) = is_array($arr)? $arr : $arr;
list($c,$d) = is_array($arr)?: NULL;
echo "ok\n";
+?>
--EXPECT--
ok
diff --git a/Zend/tests/bug60362.phpt b/Zend/tests/bug60362.phpt
index e8d16ea4cb..51a47760a2 100644
--- a/Zend/tests/bug60362.phpt
+++ b/Zend/tests/bug60362.phpt
@@ -59,6 +59,7 @@ if (empty($arr['exists'][1][0])) {
var_dump($arr['exists'][1][0]);
}
echo "DONE";
+?>
--EXPECT--
sub-key 'non_existent' is not set.
sub-key 1 is set: string(1) "o"
diff --git a/Zend/tests/bug60444.phpt b/Zend/tests/bug60444.phpt
index 38f81bc413..f450b9e4cd 100644
--- a/Zend/tests/bug60444.phpt
+++ b/Zend/tests/bug60444.phpt
@@ -3,16 +3,17 @@ Bug #60444 (Segmentation fault with include & class extending)
--FILE--
<?php
class Foo {
- public function __construct() {
- eval("class Bar extends Foo {}");
- Some::foo($this);
- }
+ public function __construct() {
+ eval("class Bar extends Foo {}");
+ Some::foo($this);
+ }
}
class Some {
- public static function foo(Foo $foo) {
- }
+ public static function foo(Foo $foo) {
+ }
}
new Foo;
echo "done\n";
+?>
--EXPECT--
done
diff --git a/Zend/tests/bug60536_001.phpt b/Zend/tests/bug60536_001.phpt
index 0847b81d40..f4129452eb 100644
--- a/Zend/tests/bug60536_001.phpt
+++ b/Zend/tests/bug60536_001.phpt
@@ -4,17 +4,17 @@ Bug #60536 (Traits Segfault)
<?php
trait T { private $x = 0; }
class X {
- use T;
+ use T;
}
class Y extends X {
- use T;
- function __construct() {
- return ++$this->x;
+ use T;
+ function __construct() {
+ return ++$this->x;
}
}
class Z extends Y {
- function __construct() {
- return ++$this->x;
+ function __construct() {
+ return ++$this->x;
}
}
$a = new Z();
@@ -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/bug60536_002.phpt b/Zend/tests/bug60536_002.phpt
index a69b33acff..4d49caa28b 100644
--- a/Zend/tests/bug60536_002.phpt
+++ b/Zend/tests/bug60536_002.phpt
@@ -1,5 +1,5 @@
--TEST--
-The same rules are applied for properties that are defined in the class hierarchy. Thus, if the properties are compatible, a notice is issued, if not a fatal error occures. (relevant with #60536)
+The same rules are applied for properties that are defined in the class hierarchy. Thus, if the properties are compatible, a notice is issued, if not a fatal error occurs. (relevant with #60536)
--FILE--
<?php
@@ -21,7 +21,7 @@ echo "POST-CLASS-GUARD\n";
// now we do the test for a fatal error
class TraitsTest {
- use THello1;
+ use THello1;
public $hello;
}
diff --git a/Zend/tests/bug60536_004.phpt b/Zend/tests/bug60536_004.phpt
index 3a81b704c8..9e21f1e46b 100644
--- a/Zend/tests/bug60536_004.phpt
+++ b/Zend/tests/bug60536_004.phpt
@@ -1,5 +1,5 @@
--TEST--
-Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consitent with normal inheritance handling. (relevant to #60536)
+Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consistent with normal inheritance handling. (relevant to #60536)
--FILE--
<?php
diff --git a/Zend/tests/bug60536_005.phpt b/Zend/tests/bug60536_005.phpt
index 6434e450ba..8ba0e57456 100644
--- a/Zend/tests/bug60536_005.phpt
+++ b/Zend/tests/bug60536_005.phpt
@@ -1,5 +1,5 @@
--TEST--
-Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consitent with normal inheritance handling. (relevant to #60536)
+Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consistent with normal inheritance handling. (relevant to #60536)
--FILE--
<?php
diff --git a/Zend/tests/bug60569.phpt b/Zend/tests/bug60569.phpt
index 56aaa2c602..480c9c8f8a 100644
--- a/Zend/tests/bug60569.phpt
+++ b/Zend/tests/bug60569.phpt
Binary files differ
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/bug60598.phpt b/Zend/tests/bug60598.phpt
index 143ac79504..2db0402fa9 100644
--- a/Zend/tests/bug60598.phpt
+++ b/Zend/tests/bug60598.phpt
@@ -9,12 +9,12 @@ $containers = array();
class ObjectOne {
protected $_guid = 0;
public function __construct() {
- global $containers;
- $this->guid = 1;
+ global $containers;
+ $this->guid = 1;
$containers[spl_object_hash($this)] = $this;
}
public function __destruct() {
- global $containers;
+ global $containers;
$containers[spl_object_hash($this)] = NULL;
}
}
diff --git a/Zend/tests/bug60611.phpt b/Zend/tests/bug60611.phpt
index abd04b0891..e90479f6ba 100644
--- a/Zend/tests/bug60611.phpt
+++ b/Zend/tests/bug60611.phpt
@@ -3,10 +3,10 @@ Bug #60611 (Segmentation fault with Cls::{expr}() syntax)
--FILE--
<?php
class Cls {
- function __call($name, $arg) {
- }
- static function __callStatic($name, $arg) {
- }
+ function __call($name, $arg) {
+ }
+ static function __callStatic($name, $arg) {
+ }
}
$cls = new Cls;
diff --git a/Zend/tests/bug60613.phpt b/Zend/tests/bug60613.phpt
index a9db68dea9..6376d99184 100644
--- a/Zend/tests/bug60613.phpt
+++ b/Zend/tests/bug60613.phpt
@@ -14,5 +14,6 @@ $cls->{true}();
$cls->{false}();
$cls->{null}();
echo "ok\n";
+?>
--EXPECTF--
Fatal error: Method name must be a string in %sbug60613.php on line %d
diff --git a/Zend/tests/bug60825.phpt b/Zend/tests/bug60825.phpt
index f2f5b602ad..c4c4975f9e 100644
--- a/Zend/tests/bug60825.phpt
+++ b/Zend/tests/bug60825.phpt
@@ -5,11 +5,11 @@ run this with valgrind
--FILE--
<?php
class test {
- public static $x;
- public function __toString() {
- self::$x = $this;
- return __FILE__;
- }
+ public static $x;
+ public function __toString() {
+ self::$x = $this;
+ return __FILE__;
+ }
}
$a = new test;
require_once $a;
diff --git a/Zend/tests/bug60833.phpt b/Zend/tests/bug60833.phpt
index fee6d01362..19cd2a4e53 100644
--- a/Zend/tests/bug60833.phpt
+++ b/Zend/tests/bug60833.phpt
@@ -3,21 +3,21 @@ Bug #60833 (self, parent, static behave inconsistently case-sensitive)
--FILE--
<?php
class A {
- static $x = "A";
- function testit() {
- $this->v1 = new sELF;
- $this->v2 = new SELF;
- }
+ static $x = "A";
+ function testit() {
+ $this->v1 = new sELF;
+ $this->v2 = new SELF;
+ }
}
class B extends A {
- static $x = "B";
- function testit() {
- PARENT::testit();
- $this->v3 = new sELF;
- $this->v4 = new PARENT;
- $this->v4 = STATIC::$x;
- }
+ static $x = "B";
+ function testit() {
+ PARENT::testit();
+ $this->v3 = new sELF;
+ $this->v4 = new PARENT;
+ $this->v4 = STATIC::$x;
+ }
}
$t = new B();
$t->testit();
diff --git a/Zend/tests/bug60909_1.phpt b/Zend/tests/bug60909_1.phpt
index c82cf6c4d5..73b451802d 100644
--- a/Zend/tests/bug60909_1.phpt
+++ b/Zend/tests/bug60909_1.phpt
@@ -9,11 +9,12 @@ set_error_handler(function($errno, $errstr, $errfile, $errline){
});
require 'notfound.php';
+?>
--EXPECTF--
-error(require(notfound.php): failed to open stream: %s)
+error(require(notfound.php): Failed to open stream: %s)
Fatal error: 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/bug60909_2.phpt b/Zend/tests/bug60909_2.phpt
index 9660a9653f..d382e66bb7 100644
--- a/Zend/tests/bug60909_2.phpt
+++ b/Zend/tests/bug60909_2.phpt
@@ -12,6 +12,7 @@ class Bad {
$bad = new Bad();
echo "$bad";
+?>
--EXPECTF--
Fatal error: Uncaught Exception: I CAN DO THIS in %s:%d
Stack trace:
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..53fd7a2fbc 100644
--- a/Zend/tests/bug61011.phpt
+++ b/Zend/tests/bug61011.phpt
@@ -1,35 +1,35 @@
--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) {
- throw new Exception($name);
+ throw new Exception($name);
});
try {
- echo AAA::$a; //zend_fetch_var_address_helper
+ echo AAA::$a; //zend_fetch_var_address_helper
} catch (Exception $e) {
- try {
- echo AAA::XXX; //ZEND_FETCH_CONSTANT
- } catch (Exception $e) {
- try {
- echo AAA::foo(); //ZEND_INIT_STATIC_METHOD_CALL
- } catch (Exception $e) {
- try {
- unset(AAA::$a); // ZEND_UNSET_VAR
- } catch (Exception $e){
- try {
- isset(AAAA::$a); // ZEND_ISSET_ISEMPTY_VAR
- } catch (Exception $e) {
- try {
- $a = array("AAA", "foo");
- $a(); //ZEND_INIT_FCALL_BY_NAME
- } catch (Exception $e) {
- }
- }
- }
- }
- }
+ try {
+ echo AAA::XXX; //ZEND_FETCH_CONSTANT
+ } catch (Exception $e) {
+ try {
+ echo AAA::foo(); //ZEND_INIT_STATIC_METHOD_CALL
+ } catch (Exception $e) {
+ try {
+ unset(AAA::$a); // ZEND_UNSET_VAR
+ } catch (Exception $e){
+ try {
+ isset(AAAA::$a); // ZEND_ISSET_ISEMPTY_VAR
+ } catch (Exception $e) {
+ try {
+ $a = array("AAA", "foo");
+ $a(); //ZEND_INIT_FCALL_BY_NAME
+ } catch (Exception $e) {
+ }
+ }
+ }
+ }
+ }
}
echo 'okey';
--EXPECT--
diff --git a/Zend/tests/bug61025.phpt b/Zend/tests/bug61025.phpt
index f6731535fb..d453d73d26 100644
--- a/Zend/tests/bug61025.phpt
+++ b/Zend/tests/bug61025.phpt
@@ -3,10 +3,6 @@ Bug #61025 (__invoke() visibility not honored)
--FILE--
<?php
-Interface InvokeAble {
- static function __invoke();
-}
-
class Bar {
private function __invoke() {
return __CLASS__;
@@ -20,11 +16,9 @@ echo $b->__invoke();
?>
--EXPECTF--
-Warning: The magic method __invoke() must have public visibility and cannot be static in %sbug61025.php on line %d
-
-Warning: The magic method __invoke() must have public visibility and cannot be static in %sbug61025.php on line %d
+Warning: The magic method Bar::__invoke() must have public visibility in %sbug61025.php on line %d
Bar
-Fatal error: Uncaught Error: Call to private method Bar::__invoke() from context '' in %sbug61025.php:%d
+Fatal error: Uncaught Error: Call to private method Bar::__invoke() from global scope in %s:%d
Stack trace:
#0 {main}
thrown in %sbug61025.php on line %d
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/bug61165.phpt b/Zend/tests/bug61165.phpt
index 900a7a8d2b..9c01d78f24 100644
--- a/Zend/tests/bug61165.phpt
+++ b/Zend/tests/bug61165.phpt
@@ -8,8 +8,8 @@ class T {
public $_this;
public function __toString() {
- global $handler;
- $handler = $this;
+ global $handler;
+ $handler = $this;
$this->_this = $this; // <-- uncomment this
return 'A';
}
@@ -18,9 +18,10 @@ class T {
$t = new T;
for ($i = 0; $i < 3; $i++) {
strip_tags($t);
- strip_tags(new T);
+ strip_tags(new T);
}
var_dump($handler);
+?>
--EXPECTF--
object(T)#%d (1) {
["_this"]=>
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/bug61273.phpt b/Zend/tests/bug61273.phpt
index aee35c6f4f..92ad2c9918 100644
--- a/Zend/tests/bug61273.phpt
+++ b/Zend/tests/bug61273.phpt
@@ -10,6 +10,7 @@ Bug #61273 (call_user_func_array with more than 16333 arguments leaks / crashes)
$args = array_fill(0, 64 * 1024 - 64, 0);
call_user_func_array(function(&$a) {}, $args);
echo strval("okey");
+?>
--EXPECTF--
-Warning: Parameter 1 to {closure}() expected to be a reference, value given in %sbug61273.php on line %d
+Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d
okey
diff --git a/Zend/tests/bug61362.phpt b/Zend/tests/bug61362.phpt
index af216b566f..ac9e976f3f 100644
--- a/Zend/tests/bug61362.phpt
+++ b/Zend/tests/bug61362.phpt
@@ -3,15 +3,15 @@ Bug #61362 (Exception::getTraceAsString, Exception::__toString not able to handl
--FILE--
<?php
function test($arg){
- throw new Exception();
+ throw new Exception();
}
try {
- test('теÑÑ‚');
+ test('теÑÑ‚');
}
catch(Exception $e) {
- echo $e->getTraceAsString(), "\n";
- echo (string)$e;
+ echo $e->getTraceAsString(), "\n";
+ echo (string)$e;
}
?>
--EXPECTF--
diff --git a/Zend/tests/bug61767.phpt b/Zend/tests/bug61767.phpt
index 5e949706e8..f47eb0cbe8 100644
--- a/Zend/tests/bug61767.phpt
+++ b/Zend/tests/bug61767.phpt
@@ -14,12 +14,13 @@ register_shutdown_function(function(){
//$undefined = null; // defined variable does not cause problems
$undefined->foo();
+?>
--EXPECTF--
-Error handler called (Undefined variable: undefined)
+Error handler called (Undefined variable $undefined)
-Fatal error: Uncaught ErrorException: Undefined variable: undefined in %sbug61767.php:%d
+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/bug61782.phpt b/Zend/tests/bug61782.phpt
index 95bf4e6cff..c6c1d196dc 100644
--- a/Zend/tests/bug61782.phpt
+++ b/Zend/tests/bug61782.phpt
@@ -23,6 +23,7 @@ Bug #61782 (__clone/__destruct do not match other methods when checking access c
$obj = new LatchkeyKid();
echo "DONE\n";
+?>
--EXPECT--
In LatchkeyKid:
MommasBoy::__clone
diff --git a/Zend/tests/bug61970.phpt b/Zend/tests/bug61970.phpt
index 9cdb87a01a..8a2335a1f9 100644
--- a/Zend/tests/bug61970.phpt
+++ b/Zend/tests/bug61970.phpt
@@ -12,5 +12,6 @@ class Bar extends Foo {
}
echo 'DONE';
+?>
--EXPECT--
DONE
diff --git a/Zend/tests/bug61970_1.phpt b/Zend/tests/bug61970_1.phpt
index 417eaa0aef..f688edf15a 100644
--- a/Zend/tests/bug61970_1.phpt
+++ b/Zend/tests/bug61970_1.phpt
@@ -10,5 +10,6 @@ abstract class Foo {
class Bar extends Foo {
protected function __construct(){}
}
+?>
--EXPECTF--
Fatal error: Access level to Bar::__construct() must be public (as in class Foo) in %s on line 8
diff --git a/Zend/tests/bug61970_2.phpt b/Zend/tests/bug61970_2.phpt
index 403ba7510a..7ba20f93bc 100644
--- a/Zend/tests/bug61970_2.phpt
+++ b/Zend/tests/bug61970_2.phpt
@@ -14,5 +14,6 @@ class Bar extends Foo {
class Baz extends Bar {
protected function __construct(){}
}
+?>
--EXPECTF--
Fatal error: Access level to Baz::__construct() must be public (as in class Foo) in %s on line 12
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/bug62069.phpt b/Zend/tests/bug62069.phpt
new file mode 100644
index 0000000000..d434e271c6
--- /dev/null
+++ b/Zend/tests/bug62069.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #62069: binding wrong traits if they have same name methods
+--FILE--
+<?php
+
+trait T1 {
+ public function func() {
+ echo "From T1\n";
+ }
+}
+
+trait T2 {
+ public function func() {
+ echo "From T2\n";
+ }
+}
+
+class Bar {
+ public function func() {
+ echo "From Bar\n";
+ }
+ use T1, T2 {
+ func as f1;
+ }
+}
+
+$b = new Bar();
+$b->f2();
+
+?>
+--EXPECTF--
+Fatal error: An alias was defined for method func(), which exists in both T1 and T2. Use T1::func or T2::func to resolve the ambiguity in %s on line %d
diff --git a/Zend/tests/bug62069_2.phpt b/Zend/tests/bug62069_2.phpt
new file mode 100644
index 0000000000..c7c42ba6d1
--- /dev/null
+++ b/Zend/tests/bug62069_2.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #62069: binding wrong traits if they have same name methods (variation 2)
+--FILE--
+<?php
+
+trait T1 {
+ public function func() {
+ echo "From T1\n";
+ }
+}
+
+trait T2 {
+ public function func() {
+ echo "From T2\n";
+ }
+}
+
+class Bar {
+ public function func() {
+ echo "From Bar\n";
+ }
+ use T1 {
+ func as f1;
+ }
+ use T2 {
+ func as f2;
+ }
+}
+
+$b = new Bar();
+$b->f2();
+
+?>
+--EXPECTF--
+Fatal error: An alias was defined for method func(), which exists in both T1 and T2. Use T1::func or T2::func to resolve the ambiguity in %s on line %d
diff --git a/Zend/tests/bug62097.phpt b/Zend/tests/bug62097.phpt
index 07e93bfa88..52dd7499dc 100644
--- a/Zend/tests/bug62097.phpt
+++ b/Zend/tests/bug62097.phpt
@@ -3,13 +3,14 @@ Bug #62097: fix for bug #54547 is wrong for 32-bit machines
--SKIPIF--
<?php
if (PHP_INT_MAX !== 2147483647)
- die('skip for system with 32-bit wide longs only');
+ die('skip for system with 32-bit wide longs only');
--FILE--
<?php
var_dump("02147483647" == "2147483647",
- "02147483648" == "2147483648",
- "09007199254740991" == "9007199254740991",
- "09007199254740992" == "9007199254740992");
+ "02147483648" == "2147483648",
+ "09007199254740991" == "9007199254740991",
+ "09007199254740992" == "9007199254740992");
+?>
--EXPECT--
bool(true)
bool(true)
diff --git a/Zend/tests/bug62609.phpt b/Zend/tests/bug62609.phpt
new file mode 100644
index 0000000000..9f4827d53a
--- /dev/null
+++ b/Zend/tests/bug62609.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #62609: Allow implementing Traversable on abstract classes (fail)
+--FILE--
+<?php
+
+abstract class AbstractTraversable implements Traversable {}
+
+class NonAbstractTraversable extends AbstractTraversable {}
+
+?>
+--EXPECT--
+Fatal error: Class NonAbstractTraversable must implement interface Traversable as part of either Iterator or IteratorAggregate in Unknown on line 0
diff --git a/Zend/tests/bug62609_2.phpt b/Zend/tests/bug62609_2.phpt
new file mode 100644
index 0000000000..c59ac8c2de
--- /dev/null
+++ b/Zend/tests/bug62609_2.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #62609: Allow implementing Traversable on abstract classes (work)
+--FILE--
+<?php
+
+abstract class AbstractTraversable implements Traversable {}
+
+class NonAbstractTraversable extends AbstractTraversable implements IteratorAggregate {
+ public function getIterator() {
+ yield "foo";
+ yield "bar";
+ }
+}
+
+foreach (new NonAbstractTraversable as $value) {
+ echo $value, "\n";
+}
+
+?>
+--EXPECT--
+foo
+bar
diff --git a/Zend/tests/bug62956.phpt b/Zend/tests/bug62956.phpt
index fab180b4c3..803a2f7d6e 100644
--- a/Zend/tests/bug62956.phpt
+++ b/Zend/tests/bug62956.phpt
@@ -4,14 +4,14 @@ Bug #62956: "incompatible" signatures for private methods should not cause E_WAR
<?php
class Base
{
- private function test()
- {}
+ private function test()
+ {}
}
class Extension extends Base
{
- private function test($arg)
- {}
+ private function test($arg)
+ {}
}
?>
diff --git a/Zend/tests/bug63111.phpt b/Zend/tests/bug63111.phpt
index 077e350bc2..2b06d3583a 100644
--- a/Zend/tests/bug63111.phpt
+++ b/Zend/tests/bug63111.phpt
@@ -9,9 +9,9 @@ interface MyInterface {
static function bar();
}
abstract class Bar {
- static function foo() {
- echo "ok\n";
- }
+ static function foo() {
+ echo "ok\n";
+ }
}
var_dump(is_callable(array("Foo", "bar")));
var_dump(is_callable("Foo::bar"));
diff --git a/Zend/tests/bug63206.phpt b/Zend/tests/bug63206.phpt
index dc7bb1fd1d..6aba55eca1 100644
--- a/Zend/tests/bug63206.phpt
+++ b/Zend/tests/bug63206.phpt
@@ -22,7 +22,7 @@ set_error_handler(function() {
$triggerNotice1++;
$triggerNotice2++;
?>
---EXPECTF--
+--EXPECT--
Second handler
Internal handler
Second handler
diff --git a/Zend/tests/bug63206_1.phpt b/Zend/tests/bug63206_1.phpt
index f08f913824..d054211638 100644
--- a/Zend/tests/bug63206_1.phpt
+++ b/Zend/tests/bug63206_1.phpt
@@ -22,5 +22,5 @@ restore_error_handler();
$triggerNotice++;
?>
---EXPECTF--
+--EXPECT--
Second handler
diff --git a/Zend/tests/bug63206_2.phpt b/Zend/tests/bug63206_2.phpt
index 7a2bf38543..a4a67f577e 100644
--- a/Zend/tests/bug63206_2.phpt
+++ b/Zend/tests/bug63206_2.phpt
@@ -22,5 +22,5 @@ restore_exception_handler();
throw new Exception();
?>
---EXPECTF--
+--EXPECT--
Second handler
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..03182224ef 100644
--- a/Zend/tests/bug63462.phpt
+++ b/Zend/tests/bug63462.phpt
@@ -5,32 +5,32 @@ Marco Pivetta <ocramius@gmail.com>
--FILE--
<?php
class Test {
- public $publicProperty;
- protected $protectedProperty;
- private $privateProperty;
+ public $publicProperty;
+ protected $protectedProperty;
+ private $privateProperty;
- public function __construct() {
- unset(
- $this->publicProperty,
- $this->protectedProperty,
- $this->privateProperty
- );
- }
+ public function __construct() {
+ unset(
+ $this->publicProperty,
+ $this->protectedProperty,
+ $this->privateProperty
+ );
+ }
- function __get($name) {
- echo '__get ' . $name . "\n";
- return $this->$name;
- }
+ function __get($name) {
+ echo '__get ' . $name . "\n";
+ return $this->$name;
+ }
- function __set($name, $value) {
- echo '__set ' . $name . "\n";
- $this->$name = $value;
- }
+ function __set($name, $value) {
+ echo '__set ' . $name . "\n";
+ $this->$name = $value;
+ }
- function __isset($name) {
- echo '__isset ' . $name . "\n";
- return isset($this->$name);
- }
+ function __isset($name) {
+ echo '__isset ' . $name . "\n";
+ return isset($this->$name);
+ }
}
$test = new Test();
@@ -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/bug63468.phpt b/Zend/tests/bug63468.phpt
index 02c3c06c17..3eb289e752 100644
--- a/Zend/tests/bug63468.phpt
+++ b/Zend/tests/bug63468.phpt
@@ -4,26 +4,27 @@ Bug #63468 (wrong called method as callback with inheritance)
<?php
class Foo
{
- public function run()
- {
- return call_user_func(array('Bar', 'getValue'));
- }
+ public function run()
+ {
+ return call_user_func(array('Bar', 'getValue'));
+ }
- private static function getValue()
- {
- return 'Foo';
- }
+ private static function getValue()
+ {
+ return 'Foo';
+ }
}
class Bar extends Foo
{
- public static function getValue()
- {
- return 'Bar';
- }
+ public static function getValue()
+ {
+ return 'Bar';
+ }
}
$x = new Bar;
var_dump($x->run());
+?>
--EXPECT--
string(3) "Bar"
diff --git a/Zend/tests/bug63635.phpt b/Zend/tests/bug63635.phpt
index 035588b295..09f8936158 100644
--- a/Zend/tests/bug63635.phpt
+++ b/Zend/tests/bug63635.phpt
@@ -3,37 +3,38 @@ Bug #63635 (Segfault in gc_collect_cycles)
--FILE--
<?php
class Node {
- public $parent = NULL;
- public $children = array();
+ public $parent = NULL;
+ public $children = array();
- function __construct(Node $parent=NULL) {
- if ($parent) {
- $parent->children[] = $this;
- }
- $this->children[] = $this;
- }
+ function __construct(Node $parent=NULL) {
+ if ($parent) {
+ $parent->children[] = $this;
+ }
+ $this->children[] = $this;
+ }
- function __destruct() {
- $this->children = NULL;
- }
+ function __destruct() {
+ $this->children = NULL;
+ }
}
define("MAX", 16);
for ($n = 0; $n < 20; $n++) {
- $top = new Node();
- for ($i=0 ; $i<MAX ; $i++) {
- $ci = new Node($top);
- for ($j=0 ; $j<MAX ; $j++) {
- $cj = new Node($ci);
- for ($k=0 ; $k<MAX ; $k++) {
- $ck = new Node($cj);
- }
- }
- }
- echo "$n\n";
+ $top = new Node();
+ for ($i=0 ; $i<MAX ; $i++) {
+ $ci = new Node($top);
+ for ($j=0 ; $j<MAX ; $j++) {
+ $cj = new Node($ci);
+ for ($k=0 ; $k<MAX ; $k++) {
+ $ck = new Node($cj);
+ }
+ }
+ }
+ echo "$n\n";
}
echo "ok\n";
+?>
--EXPECT--
0
1
diff --git a/Zend/tests/bug63762.phpt b/Zend/tests/bug63762.phpt
index d848b74f55..9b2fd8b5fe 100644
--- a/Zend/tests/bug63762.phpt
+++ b/Zend/tests/bug63762.phpt
@@ -39,14 +39,14 @@ string(36) "#0 [internal function]: ()
Array of array of NULL values:
-Warning: Function name is no string in %s on line %d
+Warning: Function name is not a string in %s on line %d
-Warning: Value for class is no string in %s on line %d
+Warning: Value for class is not a string in %s on line %d
-Warning: Value for type is no string in %s on line %d
+Warning: Value for type is not a string in %s on line %d
-Warning: Value for function is no string in %s on line %d
+Warning: Value for function is not a string in %s on line %d
-Warning: args element is no array in %s on line %d
+Warning: args element is not an array in %s on line %d
string(60) "#0 [unknown function][unknown][unknown][unknown]()
#1 {main}"
diff --git a/Zend/tests/bug63982.phpt b/Zend/tests/bug63982.phpt
index 4318a5091c..f482aa4891 100644
--- a/Zend/tests/bug63982.phpt
+++ b/Zend/tests/bug63982.phpt
@@ -10,6 +10,7 @@ $test = new Test();
var_dump(isset($test->protectedProperty));
var_dump(isset($test->protectedProperty->foo));
+?>
--EXPECT--
bool(false)
bool(false)
diff --git a/Zend/tests/bug64135.phpt b/Zend/tests/bug64135.phpt
index e4be3e0c64..b4f4c82b3a 100644
--- a/Zend/tests/bug64135.phpt
+++ b/Zend/tests/bug64135.phpt
@@ -13,5 +13,6 @@ try {
} catch(Throwable $e) {
echo "Exception is thrown";
}
+?>
--EXPECT--
Exception is thrown
diff --git a/Zend/tests/bug64239_1.phpt b/Zend/tests/bug64239_1.phpt
index 10d44c1817..2e3c7173bc 100644
--- a/Zend/tests/bug64239_1.phpt
+++ b/Zend/tests/bug64239_1.phpt
@@ -3,18 +3,19 @@ Bug #64239 (get_class_methods() changed behavior)
--FILE--
<?php
class A {
- use T2 { t2method as Bmethod; }
+ use T2 { t2method as Bmethod; }
}
class B extends A {
}
trait T2 {
- public function t2method() {
- }
+ public function t2method() {
+ }
}
print_r(get_class_methods("A"));
print_r(get_class_methods("B"));
+?>
--EXPECT--
Array
(
diff --git a/Zend/tests/bug64239_2.phpt b/Zend/tests/bug64239_2.phpt
index 26cf8ee1af..1a96de8b52 100644
--- a/Zend/tests/bug64239_2.phpt
+++ b/Zend/tests/bug64239_2.phpt
@@ -3,27 +3,27 @@ Bug #64239 (debug_backtrace() changed behavior)
--FILE--
<?php
class A {
- use T1;
- public function test() { $this->backtrace(); }
+ use T1;
+ public function test() { $this->backtrace(); }
}
class B {
- use T2 { t2method as Bmethod; }
+ use T2 { t2method as Bmethod; }
}
class C extends A {
}
trait T1 {
- protected function backtrace() {
- $b = new B();
- $b->Bmethod();
- }
+ protected function backtrace() {
+ $b = new B();
+ $b->Bmethod();
+ }
}
trait T2 {
- public function t2method() {
- print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1));
- }
+ public function t2method() {
+ print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1));
+ }
}
$a = new A();
$a->test();
diff --git a/Zend/tests/bug64239_3.phpt b/Zend/tests/bug64239_3.phpt
index 15faeb9852..1a7da60e3c 100644
--- a/Zend/tests/bug64239_3.phpt
+++ b/Zend/tests/bug64239_3.phpt
@@ -3,19 +3,19 @@ Bug #64239 (debug_print_backtrace() changed behavior)
--FILE--
<?php
class A {
- use T2 { t2method as Bmethod; }
+ use T2 { t2method as Bmethod; }
}
class C extends A {
- public function Bmethod() {
- debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
+ public function Bmethod() {
+ debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
}
}
trait T2 {
- public function t2method() {
- debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
- }
+ public function t2method() {
+ debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
+ }
}
$a = new A();
diff --git a/Zend/tests/bug64239_4.phpt b/Zend/tests/bug64239_4.phpt
index 7ab761ef72..8204a5b843 100644
--- a/Zend/tests/bug64239_4.phpt
+++ b/Zend/tests/bug64239_4.phpt
@@ -3,19 +3,19 @@ Bug #64239 (debug_print_backtrace() changed behavior)
--FILE--
<?php
class A {
- use T2 { t2method as Bmethod; }
+ use T2 { t2method as Bmethod; }
}
class C extends A {
- public static function Bmethod() {
- debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
+ public static function Bmethod() {
+ debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
}
}
trait T2 {
- public static function t2method() {
- debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
- }
+ public static function t2method() {
+ debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
+ }
}
A::Bmethod();
diff --git a/Zend/tests/bug64417.phpt b/Zend/tests/bug64417.phpt
index 9b192f31b5..6d1b084dca 100644
--- a/Zend/tests/bug64417.phpt
+++ b/Zend/tests/bug64417.phpt
@@ -18,7 +18,7 @@ trait aa {
unset($this->container[$offset]);
}
public function &offsetGet($offset) {
- $result = null;
+ $result = null;
if (isset($this->container[$offset])) {
$result = &$this->container[$offset];
}
@@ -34,5 +34,6 @@ $o = new obj;
$o['x'] = 1;
++$o['x'];
echo $o['x'], "\n";
+?>
--EXPECT--
2
diff --git a/Zend/tests/bug64515.phpt b/Zend/tests/bug64515.phpt
index b101c17c3a..aeb2cd1564 100644
--- a/Zend/tests/bug64515.phpt
+++ b/Zend/tests/bug64515.phpt
@@ -3,7 +3,7 @@ Bug #64515 (Memoryleak when using the same variablename 2times in function decla
--FILE--
<?php
function foo($unused = null, $unused = null, $arg = array()) {
- return 1;
+ return 1;
}
foo();
echo "okey";
diff --git a/Zend/tests/bug64578.phpt b/Zend/tests/bug64578.phpt
index b4018e96a2..7d4a32be87 100644
--- a/Zend/tests/bug64578.phpt
+++ b/Zend/tests/bug64578.phpt
@@ -5,10 +5,11 @@ Bug #64578 (debug_backtrace in set_error_handler corrupts zend heap: segfault)
set_error_handler(function($no, $err) { var_dump($err); });
-function x($s) { $s['a'] = 1; };
+function x($s) { $s['2a'] = 1; };
$y = '1';
x($y);
print_r($y);
+?>
--EXPECT--
-string(25) "Illegal string offset 'a'"
+string(26) "Illegal string offset "2a""
1
diff --git a/Zend/tests/bug64677.phpt b/Zend/tests/bug64677.phpt
index 44a7c5fc6f..2dcd00ce0a 100644
--- a/Zend/tests/bug64677.phpt
+++ b/Zend/tests/bug64677.phpt
@@ -3,8 +3,8 @@ Bug #64677 (execution operator `` stealing surrounding arguments)
--FILE--
<?PHP
class cat {
- public function show_output($prepend, $output = '') {
- }
+ public function show_output($prepend, $output = '') {
+ }
}
$cat = new cat();
$cat->show_output('Files: ', trim(`cd .`)); // this gives invalid args to shell_exec
@@ -12,7 +12,7 @@ $cat->show_output('Files: ', `cd .`); // this causes a segmentation fault
$cat->show_output(`cd .`); // this causes a segmentation fault
function show_outputa($prepend, $output) {
- echo "Okey";
+ echo "Okey";
}
show_outputa('Files: ', `cd .`); // this works as expected
diff --git a/Zend/tests/bug64821.1.phpt b/Zend/tests/bug64821.1.phpt
index 39bec77a45..52713e2211 100644
--- a/Zend/tests/bug64821.1.phpt
+++ b/Zend/tests/bug64821.1.phpt
@@ -4,12 +4,12 @@ Bug #64821 Custom Exceptions crash when internal properties overridden (variatio
<?php
class a extends exception {
- public function __construct() {
- $this->message = NULL;
- $this->string = NULL;
- $this->code = array();
- $this->line = "hello";
- }
+ public function __construct() {
+ $this->message = NULL;
+ $this->string = NULL;
+ $this->code = array();
+ $this->line = "hello";
+ }
}
throw new a;
diff --git a/Zend/tests/bug64821.2.phpt b/Zend/tests/bug64821.2.phpt
index 5650c48872..cac0a948f9 100644
--- a/Zend/tests/bug64821.2.phpt
+++ b/Zend/tests/bug64821.2.phpt
@@ -4,9 +4,9 @@ Bug #64821 Custom Exceptions crash when internal properties overridden (variatio
<?php
class a extends exception {
- public function __construct() {
- $this->line = array();
- }
+ public function __construct() {
+ $this->line = array();
+ }
}
throw new a;
diff --git a/Zend/tests/bug64821.3.phpt b/Zend/tests/bug64821.3.phpt
index 831665e364..d94f1ba361 100644
--- a/Zend/tests/bug64821.3.phpt
+++ b/Zend/tests/bug64821.3.phpt
@@ -4,10 +4,10 @@ Bug #64821 Custom Exceptions crash when internal properties overridden (variatio
<?php
class a extends exception {
- public function __construct() {
- $this->line = array();
- $this->file = NULL;
- }
+ public function __construct() {
+ $this->line = array();
+ $this->file = NULL;
+ }
}
throw new a;
diff --git a/Zend/tests/bug64896.phpt b/Zend/tests/bug64896.phpt
index 59c59b7fe2..cae45e3b2e 100644
--- a/Zend/tests/bug64896.phpt
+++ b/Zend/tests/bug64896.phpt
@@ -7,18 +7,18 @@ zend.enable_gc=1
$bar = NULL;
class bad
{
- private $_private = array();
+ private $_private = array();
- public function __construct()
- {
- $this->_private[] = 'php';
- }
+ public function __construct()
+ {
+ $this->_private[] = 'php';
+ }
- public function __destruct()
- {
- global $bar;
- $bar = $this;
- }
+ public function __destruct()
+ {
+ global $bar;
+ $bar = $this;
+ }
}
$foo = new stdclass;
diff --git a/Zend/tests/bug64960.phpt b/Zend/tests/bug64960.phpt
index 52af0bbe32..360b5bf722 100644
--- a/Zend/tests/bug64960.phpt
+++ b/Zend/tests/bug64960.phpt
@@ -6,34 +6,34 @@ Bug #64960 (Segfault in gc_zval_possible_root)
ob_end_flush();
class ExceptionHandler {
- public function __invoke (Exception $e)
- {
- // this triggers the custom error handler
- ob_end_clean();
- }
+ public function __invoke (Exception $e)
+ {
+ // this triggers the custom error handler
+ ob_end_clean();
+ }
}
// this must be a class, closure does not trigger segfault
set_exception_handler(new ExceptionHandler());
-// exception must be throwed from error handler.
+// exception must be thrown from error handler.
set_error_handler(function()
{
- $e = new Exception;
- $e->_trace = debug_backtrace();
+ $e = new Exception;
+ $e->_trace = debug_backtrace();
- throw $e;
+ throw $e;
});
// trigger error handler
$a['waa'];
?>
--EXPECTF--
-Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %sbug64960.php on line 3
+Notice: ob_end_flush(): Failed to delete and flush buffer. No buffer to delete or flush in %sbug64960.php on line 3
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/bug64966.phpt b/Zend/tests/bug64966.phpt
index 329503e5af..0d610ce2ff 100644
--- a/Zend/tests/bug64966.phpt
+++ b/Zend/tests/bug64966.phpt
@@ -3,18 +3,18 @@ Bug #64966 (segfault in zend_do_fcall_common_helper_SPEC)
--FILE--
<?php
function test($func) {
- try {
- $a = $func("");
- } catch (Error $e) {
- throw new Exception();
- }
- return true;
+ try {
+ $a = $func("");
+ } catch (Error $e) {
+ throw new Exception();
+ }
+ return true;
}
class A {
- public function b() {
- test("strlen");
- test("iterator_apply");
- }
+ public function b() {
+ test("strlen");
+ test("iterator_apply");
+ }
}
$a = new A();
diff --git a/Zend/tests/bug64988.phpt b/Zend/tests/bug64988.phpt
index 41d89cc54c..d295af7dd8 100644
--- a/Zend/tests/bug64988.phpt
+++ b/Zend/tests/bug64988.phpt
@@ -3,28 +3,27 @@ Bug #64988 (Class loading order affects E_WARNING warning)
--FILE--
<?php
abstract class Base1 {
- public function insert(array $data){
- return array_reverse($data);
- }
+ public function insert(array $data){
+ return array_reverse($data);
+ }
}
class Noisy1 extends Base1 {
- public function insert(array $data, $option1 = Null) {
- if (!empty($option1)) {
- $data['option1'] = $option1;
- }
- return parent::insert($data);
- }
+ public function insert(array $data, $option1 = Null) {
+ if (!empty($option1)) {
+ $data['option1'] = $option1;
+ }
+ return parent::insert($data);
+ }
}
class Smooth1 extends Noisy1 {
- public function insert(array $data) {
- return parent::insert($data, count($data));
- }
+ public function insert(array $data) {
+ return parent::insert($data, count($data));
+ }
}
$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 %s on line %d
diff --git a/Zend/tests/bug65108.phpt b/Zend/tests/bug65108.phpt
index 23e1e856d7..04fe3e134d 100644
--- a/Zend/tests/bug65108.phpt
+++ b/Zend/tests/bug65108.phpt
@@ -3,15 +3,15 @@ Bug #65108 (is_callable() triggers Fatal Error)
--FILE--
<?php
class C {
- private function f() {}
- static function __callStatic($name, $args) {}
+ private function f() {}
+ static function __callStatic($name, $args) {}
}
class B {
- public function __construct() {
- $isCallable = is_callable(array(new C, 'f'));
- var_dump($isCallable);
- }
+ public function __construct() {
+ $isCallable = is_callable(array(new C, 'f'));
+ var_dump($isCallable);
+ }
}
new B();
@@ -22,6 +22,7 @@ Class E {
}
$isCallable = is_callable(array('E', 'f'));
var_dump($isCallable);
+?>
--EXPECT--
bool(false)
bool(false)
diff --git a/Zend/tests/bug65254.phpt b/Zend/tests/bug65254.phpt
index d58759bfd4..81f1fd5ccd 100644
--- a/Zend/tests/bug65254.phpt
+++ b/Zend/tests/bug65254.phpt
@@ -16,5 +16,6 @@ catch (Exception $e)
{
echo 'caught';
}
+?>
--EXPECT--
caught
diff --git a/Zend/tests/bug65291.phpt b/Zend/tests/bug65291.phpt
index 7bc76331c0..c02e8d6409 100644
--- a/Zend/tests/bug65291.phpt
+++ b/Zend/tests/bug65291.phpt
@@ -5,14 +5,14 @@ Bug #65291 - get_defined_constants() causes PHP to crash in a very limited case.
trait TestTrait
{
- public static function testStaticFunction()
- {
- return __CLASS__;
- }
+ public static function testStaticFunction()
+ {
+ return __CLASS__;
+ }
}
class Tester
{
- use TestTrait;
+ use TestTrait;
}
$foo = Tester::testStaticFunction();
diff --git a/Zend/tests/bug65322.phpt b/Zend/tests/bug65322.phpt
index 4985ae55d6..0a64783d68 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(%d) "The magic method A::__invoke() must have public visibility"
string(%d) "%s(%d) : eval()'d code"
string(1) "X"
diff --git a/Zend/tests/bug65579.phpt b/Zend/tests/bug65579.phpt
index 25d74ed4f5..e5ed632416 100644
--- a/Zend/tests/bug65579.phpt
+++ b/Zend/tests/bug65579.phpt
@@ -25,5 +25,5 @@ array(2) {
[0]=>
string(10) "testMethod"
[1]=>
- string(25) "testmethodfromparenttrait"
+ string(25) "testMethodFromParentTrait"
}
diff --git a/Zend/tests/bug65784.phpt b/Zend/tests/bug65784.phpt
index 43369e2d60..78a7cd12d9 100644
--- a/Zend/tests/bug65784.phpt
+++ b/Zend/tests/bug65784.phpt
@@ -3,56 +3,57 @@ Fixed Bug #65784 (Segfault with finally)
--FILE--
<?php
function foo1() {
- try {
- throw new Exception("not catch");
- return true;
- } finally {
- try {
- throw new Exception("caught");
- } catch (Exception $e) {
- }
- }
+ try {
+ throw new Exception("not catch");
+ return true;
+ } finally {
+ try {
+ throw new Exception("caught");
+ } catch (Exception $e) {
+ }
+ }
}
try {
- $foo = foo1();
- var_dump($foo);
+ $foo = foo1();
+ var_dump($foo);
} catch (Exception $e) {
- do {
- var_dump($e->getMessage());
- } while ($e = $e->getPrevious());
+ do {
+ var_dump($e->getMessage());
+ } while ($e = $e->getPrevious());
}
function foo2() {
- try {
- try {
- throw new Exception("caught");
- return true;
- } finally {
- try {
- throw new Exception("caught");
- } catch (Exception $e) {
- }
- }
- } catch (Exception $e) {
- }
+ try {
+ try {
+ throw new Exception("caught");
+ return true;
+ } finally {
+ try {
+ throw new Exception("caught");
+ } catch (Exception $e) {
+ }
+ }
+ } catch (Exception $e) {
+ }
}
$foo = foo2();
var_dump($foo);
function foo3() {
- try {
- throw new Exception("not caught");
- return true;
- } finally {
- try {
- throw new NotExists();
- } catch (Exception $e) {
- }
- }
+ try {
+ throw new Exception("not caught");
+ return true;
+ } finally {
+ try {
+ throw new NotExists();
+ } catch (Exception $e) {
+ }
+ }
}
$bar = foo3();
+?>
--EXPECTF--
string(9) "not catch"
NULL
@@ -62,7 +63,7 @@ Stack trace:
#0 %sbug65784.php(52): foo3()
#1 {main}
-Next Error: Class 'NotExists' not found in %sbug65784.php:46
+Next Error: Class "NotExists" not found in %s:%d
Stack trace:
#0 %sbug65784.php(52): foo3()
#1 {main}
diff --git a/Zend/tests/bug65911.phpt b/Zend/tests/bug65911.phpt
index 753c8c6c7d..cea7cdc1de 100644
--- a/Zend/tests/bug65911.phpt
+++ b/Zend/tests/bug65911.phpt
@@ -6,18 +6,18 @@ class A {}
class B
{
- public function go()
- {
- $this->foo = 'bar';
- echo A::$this->foo; // should not output 'bar'
- }
+ public function go()
+ {
+ $this->foo = 'bar';
+ echo A::$this->foo; // should not output 'bar'
+ }
}
$obj = new B();
$obj->go();
?>
--EXPECTF--
-Fatal error: Uncaught Error: Access to undeclared static property: A::$this in %s:%d
+Fatal error: Uncaught Error: Access to undeclared static property A::$this in %s:%d
Stack trace:
#0 %s(%d): B->go()
#1 {main}
diff --git a/Zend/tests/bug66015.phpt b/Zend/tests/bug66015.phpt
index 5e0815240d..41521455e8 100644
--- a/Zend/tests/bug66015.phpt
+++ b/Zend/tests/bug66015.phpt
@@ -23,8 +23,6 @@ class Test
$test = new Test();
?>
-
-===DONE===
--EXPECT--
array (
1 => 'first',
@@ -32,4 +30,3 @@ array (
3 => 'third',
4 => 4,
)
-===DONE===
diff --git a/Zend/tests/bug66218.phpt b/Zend/tests/bug66218.phpt
index d800605ac8..5809af741e 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--
@@ -10,9 +9,9 @@ if (!function_exists("dl")) die("skip need dl");
$tab = get_extension_funcs("standard");
$fcts = array("dl");
foreach ($fcts as $fct) {
- if (in_array($fct, $tab)) {
- echo "$fct Ok\n";
- }
+ if (in_array($fct, $tab)) {
+ echo "$fct Ok\n";
+ }
}
?>
Done
diff --git a/Zend/tests/bug66252.phpt b/Zend/tests/bug66252.phpt
index 93f6253a55..3816ebda09 100644
--- a/Zend/tests/bug66252.phpt
+++ b/Zend/tests/bug66252.phpt
@@ -3,12 +3,13 @@ Bug #66252 (Problems in AST evaluation invalidating valid parent:: reference)
--FILE--
<?php
class A {
- const HW = "this is A";
+ const HW = "this is A";
}
class B extends A {
- const BHW = parent::HW . " extended by B";
+ const BHW = parent::HW . " extended by B";
}
const C = B::BHW;
echo C, "\n";
+?>
--EXPECT--
this is A extended by B
diff --git a/Zend/tests/bug66608.phpt b/Zend/tests/bug66608.phpt
index 5a499a1dab..367ae4e419 100644
--- a/Zend/tests/bug66608.phpt
+++ b/Zend/tests/bug66608.phpt
@@ -3,60 +3,61 @@ Bug #66608 (Incorrect behavior with nested "finally" blocks)
--FILE--
<?php
function bar() {
- try {
- echo "1\n";
- try {
- } finally {
- try {
- } finally {
- }
- echo "2\n";
- }
- } finally {
- try {
- throw new Exception ("");
- } catch (Exception $ab) {
- echo "3\n";
- } finally {
- try {
- } finally {
- echo "4\n";
- try {
- } finally {
- }
- echo "5\n";
- }
- }
- echo "6\n";
- try {
- } finally {
- while (1) {
- try {
- echo "7\n";
- break;
- } finally {
- echo "8\n";
- }
- echo "bad";
- }
- echo "9\n";
- while (1) {
- try {
- throw new Exception("");
- } catch(Exception $e) {
- echo "10\n";
- break;
- } finally {
- echo "11\n";
- }
- echo "bak\n";
- }
- }
- echo "12\n";
- }
- echo "13\n";
+ try {
+ echo "1\n";
+ try {
+ } finally {
+ try {
+ } finally {
+ }
+ echo "2\n";
+ }
+ } finally {
+ try {
+ throw new Exception ("");
+ } catch (Exception $ab) {
+ echo "3\n";
+ } finally {
+ try {
+ } finally {
+ echo "4\n";
+ try {
+ } finally {
+ }
+ echo "5\n";
+ }
+ }
+ echo "6\n";
+ try {
+ } finally {
+ while (1) {
+ try {
+ echo "7\n";
+ break;
+ } finally {
+ echo "8\n";
+ }
+ echo "bad";
+ }
+ echo "9\n";
+ while (1) {
+ try {
+ throw new Exception("");
+ } catch(Exception $e) {
+ echo "10\n";
+ break;
+ } finally {
+ echo "11\n";
+ }
+ echo "bak\n";
+ }
+ }
+ echo "12\n";
+ }
+ echo "13\n";
}
bar();
+?>
--EXPECT--
1
2
diff --git a/Zend/tests/bug66609.phpt b/Zend/tests/bug66609.phpt
index 206f7757d9..f8c0d9ce67 100644
--- a/Zend/tests/bug66609.phpt
+++ b/Zend/tests/bug66609.phpt
@@ -5,16 +5,16 @@ Bug #66609 (php crashes with __get() and ++ operator in some cases)
$bar = new Bar;
$foo = new Foo;
class Bar {
- public function __get($x) {
- global $foo;
- return $foo->foo;
- }
+ public function __get($x) {
+ global $foo;
+ return $foo->foo;
+ }
}
class Foo {
- public function __get($x) {
- global $bar;
- return $bar->bar;
- }
+ public function __get($x) {
+ global $bar;
+ return $bar->bar;
+ }
}
$foo->blah += 1; //crash
++$foo->blah; //crash
@@ -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..8077b01881 100644
--- a/Zend/tests/bug67314.phpt
+++ b/Zend/tests/bug67314.phpt
@@ -14,9 +14,10 @@ crash();
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/bug67368.phpt b/Zend/tests/bug67368.phpt
index b3aff293a0..f588270f59 100644
--- a/Zend/tests/bug67368.phpt
+++ b/Zend/tests/bug67368.phpt
@@ -5,8 +5,9 @@ report_memleaks=1
--FILE--
<?php
class FooBar {
- const bar = ["bar" => 3]["bar"];
+ const bar = ["bar" => 3]["bar"];
}
echo "okey";
+?>
--EXPECT--
okey
diff --git a/Zend/tests/bug67436/a.inc b/Zend/tests/bug67436/a.inc
index c560c2db7d..f49556c84d 100644
--- a/Zend/tests/bug67436/a.inc
+++ b/Zend/tests/bug67436/a.inc
@@ -1,10 +1,10 @@
<?php
class a {
- public function test($arg = c::TESTCONSTANT) {
- echo __METHOD__ . "($arg)\n";
- }
+ public function test($arg = c::TESTCONSTANT) {
+ echo __METHOD__ . "($arg)\n";
+ }
- static public function staticTest() {
- }
+ static public function staticTest() {
+ }
}
diff --git a/Zend/tests/bug67436/b.inc b/Zend/tests/bug67436/b.inc
index 793a1394d6..86817825f6 100644
--- a/Zend/tests/bug67436/b.inc
+++ b/Zend/tests/bug67436/b.inc
@@ -1,8 +1,10 @@
<?php
class b extends a {
- public function test() {
- echo __METHOD__ . "()\n";
- parent::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..7496973580 100644
--- a/Zend/tests/bug67436/bug67436.phpt
+++ b/Zend/tests/bug67436/bug67436.phpt
@@ -2,22 +2,27 @@
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
spl_autoload_register(function($classname) {
- if (in_array($classname, array('a','b','c'))) {
- require_once __DIR__ . "/{$classname}.inc";
- }
+ if (in_array($classname, array('a','b','c'))) {
+ require_once __DIR__ . "/{$classname}.inc";
+ }
});
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
+ var_dump($errstr);
}, error_reporting());
a::staticTest();
$b = new b();
$b->test();
---EXPECT--
+?>
+--EXPECTF--
+string(%d) "The magic method b::__invoke() must have public visibility"
b::test()
a::test(c::TESTCONSTANT)
diff --git a/Zend/tests/bug67436/bug67436_nohandler.phpt b/Zend/tests/bug67436/bug67436_nohandler.phpt
index a155ccc842..3dacb1bc96 100644
--- a/Zend/tests/bug67436/bug67436_nohandler.phpt
+++ b/Zend/tests/bug67436/bug67436_nohandler.phpt
@@ -4,16 +4,17 @@ bug67436: E_WARNING instead of custom error handler
<?php
spl_autoload_register(function($classname) {
- if (in_array($classname, array('a','b','c'))) {
- require_once __DIR__ . "/{$classname}.inc";
- }
+ if (in_array($classname, array('a','b','c'))) {
+ require_once __DIR__ . "/{$classname}.inc";
+ }
});
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 b::__invoke() must have public visibility in %s on line %d
b::test()
a::test(c::TESTCONSTANT)
diff --git a/Zend/tests/bug67436/c.inc b/Zend/tests/bug67436/c.inc
index 47c848bfa0..368e2b1f85 100644
--- a/Zend/tests/bug67436/c.inc
+++ b/Zend/tests/bug67436/c.inc
@@ -1,5 +1,5 @@
<?php
class c {
- const TESTCONSTANT = "c::TESTCONSTANT";
+ const TESTCONSTANT = "c::TESTCONSTANT";
}
diff --git a/Zend/tests/bug67856.phpt b/Zend/tests/bug67856.phpt
index e867c8f37c..b88df39341 100644
--- a/Zend/tests/bug67856.phpt
+++ b/Zend/tests/bug67856.phpt
@@ -7,5 +7,16 @@ var_dump(array_reduce($array, function(&$a, &$b) {
return $a + $b;
}, 0));
?>
---EXPECT--
+--EXPECTF--
+Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d
+
+Warning: {closure}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d
+
+Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d
+
+Warning: {closure}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d
+
+Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d
+
+Warning: {closure}(): Argument #2 ($b) must be passed by reference, value given in %s on line %d
int(6)
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/bug67922.phpt b/Zend/tests/bug67922.phpt
index 8be3f2eba0..c6ca10d8b6 100644
--- a/Zend/tests/bug67922.phpt
+++ b/Zend/tests/bug67922.phpt
@@ -4,9 +4,9 @@ Bug #67922: Member function not found when dereferencing in write-context
<?php
class C {
- public function test() {
- return new stdClass;
- }
+ public function test() {
+ return new stdClass;
+ }
}
$b = new stdClass;
diff --git a/Zend/tests/bug67938.phpt b/Zend/tests/bug67938.phpt
index 6597c4895f..fc8a9ab517 100644
--- a/Zend/tests/bug67938.phpt
+++ b/Zend/tests/bug67938.phpt
@@ -20,8 +20,10 @@ class Test implements TestInterface {
$obj = new Test;
$obj->foo();
$obj->bar([]);
+$obj->bar([], 1);
?>
--EXPECT--
Test::foo
Test::bar
+Test::bar
diff --git a/Zend/tests/bug68215.phpt b/Zend/tests/bug68215.phpt
index c4e8da8515..0a18ef64ce 100644
--- a/Zend/tests/bug68215.phpt
+++ b/Zend/tests/bug68215.phpt
@@ -3,53 +3,53 @@ Bug #68215 (Behavior of foreach has changed)
--FILE--
<?php
$arr = array(
- 'a' => array(
- 'a' => 'apple',
- 'b' => 'banana',
- 'c' => 'cranberry',
- 'd' => 'mango',
- 'e' => 'pineapple'
- ),
- 'b' => array(
- 'a' => 'apple',
- 'b' => 'banana',
- 'c' => 'cranberry',
- 'd' => 'mango',
- 'e' => 'pineapple'
- ),
- 'c' => 'cranberry',
- 'd' => 'mango',
- 'e' => 'pineapple'
+ 'a' => array(
+ 'a' => 'apple',
+ 'b' => 'banana',
+ 'c' => 'cranberry',
+ 'd' => 'mango',
+ 'e' => 'pineapple'
+ ),
+ 'b' => array(
+ 'a' => 'apple',
+ 'b' => 'banana',
+ 'c' => 'cranberry',
+ 'd' => 'mango',
+ 'e' => 'pineapple'
+ ),
+ 'c' => 'cranberry',
+ 'd' => 'mango',
+ 'e' => 'pineapple'
);
function test(&$child, $entry)
{
- $i = 1;
+ $i = 1;
- foreach ($child AS $key => $fruit)
- {
- if (!is_numeric($key))
- {
- $child[$i] = $fruit;
- unset($child[$key]);
- $i++;
- }
- }
+ foreach ($child AS $key => $fruit)
+ {
+ if (!is_numeric($key))
+ {
+ $child[$i] = $fruit;
+ unset($child[$key]);
+ $i++;
+ }
+ }
}
$i = 1;
foreach ($arr AS $key => $fruit)
{
- $arr[$i] = $fruit;
+ $arr[$i] = $fruit;
- if (is_array($fruit))
- {
- test($arr[$i], $fruit);
- }
+ if (is_array($fruit))
+ {
+ test($arr[$i], $fruit);
+ }
- unset($arr[$key]);
- $i++;
+ unset($arr[$key]);
+ $i++;
}
var_dump($arr);
diff --git a/Zend/tests/bug68370.phpt b/Zend/tests/bug68370.phpt
index 73411ca9b9..ec5f5ed9ff 100644
--- a/Zend/tests/bug68370.phpt
+++ b/Zend/tests/bug68370.phpt
@@ -3,14 +3,15 @@ Bug #68370 "unset($this)" can make the program crash
--FILE--
<?php
class C {
- public function test() {
- unset($this);
- return get_defined_vars();
- }
+ public function test() {
+ unset($this);
+ return get_defined_vars();
+ }
}
$c = new C();
$x = $c->test();
print_r($x);
unset($c, $x);
+?>
--EXPECTF--
Fatal error: Cannot unset $this in %sbug68370.php on line 4
diff --git a/Zend/tests/bug68446.phpt b/Zend/tests/bug68446.phpt
index 9648966691..34cdb23149 100644
--- a/Zend/tests/bug68446.phpt
+++ b/Zend/tests/bug68446.phpt
@@ -6,11 +6,11 @@ const FOO = [1];
const BAR = null;
function a(array $a = FOO) {
- var_dump($a);
+ var_dump($a);
}
-function b(array $b = BAR) {
- var_dump($b);
+function b(?array $b = BAR) {
+ var_dump($b);
}
b(null);
@@ -32,7 +32,7 @@ array(1) {
int(1)
}
-Fatal error: Uncaught TypeError: Argument 1 passed to a() must be of the type array, null given, called in %s on line %d and defined in %s:%d
+Fatal error: Uncaught TypeError: a(): Argument #1 ($a) must be of type array, null given, called in %s:%d
Stack trace:
#0 %s(%d): a(NULL)
#1 {main}
diff --git a/Zend/tests/bug68475.phpt b/Zend/tests/bug68475.phpt
index 1bf74f2603..fef8173fc6 100644
--- a/Zend/tests/bug68475.phpt
+++ b/Zend/tests/bug68475.phpt
@@ -54,4 +54,4 @@ Static method called!
Static method called with args: arg1, arg2, arg3
Static method called with args: arg1, arg2, arg3
Call to undefined method TestClass::undefinedMethod()
-Class 'UndefinedClass' not found
+Class "UndefinedClass" not found
diff --git a/Zend/tests/bug68797.phpt b/Zend/tests/bug68797.phpt
index db0306049f..0202a63125 100644
--- a/Zend/tests/bug68797.phpt
+++ b/Zend/tests/bug68797.phpt
@@ -7,7 +7,5 @@ precision=17
echo 2.2250738585072012e-308, "\n";
?>
-==DONE==
--EXPECT--
2.2250738585072014E-308
-==DONE==
diff --git a/Zend/tests/bug68896.phpt b/Zend/tests/bug68896.phpt
index 31823a2873..b3b62a6ed0 100644
--- a/Zend/tests/bug68896.phpt
+++ b/Zend/tests/bug68896.phpt
@@ -3,10 +3,10 @@ Bug #68896 (Changing ArrayObject value cause Segment Fault)
--FILE--
<?php
class A implements ArrayAccess {
- private $a = [];
- function offsetGet($offset) {
- return $this->a[$offset];
- }
+ private $a = [];
+ function offsetGet($offset) {
+ return $this->a[$offset];
+ }
function offsetSet($offset, $value) {
$this->a[$offset] = $value;
}
@@ -26,6 +26,7 @@ $obj = new A;
$obj["a"] = 1;
$obj["a"] .= "test";
var_dump($obj["a"]);
+?>
--EXPECT--
string(5) "1test"
string(5) "1test"
diff --git a/Zend/tests/bug69017.phpt b/Zend/tests/bug69017.phpt
index 762fcbc9a0..d1608ebbf9 100644
--- a/Zend/tests/bug69017.phpt
+++ b/Zend/tests/bug69017.phpt
@@ -5,25 +5,29 @@
class c1
{
- const ZERO = 0;
- const ONE = 1;
- const MAX = PHP_INT_MAX;
- public static $a1 = array(self::ONE => 'one');
- public static $a2 = array(self::ZERO => 'zero');
- public static $a3 = array(self::MAX => 'zero');
+ const ZERO = 0;
+ const ONE = 1;
+ const MAX = PHP_INT_MAX;
+ public static $a1 = array(self::ONE => 'one');
+ public static $a2 = array(self::ZERO => 'zero');
+ public static $a3 = array(self::MAX => 'zero');
}
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/bug69025.phpt b/Zend/tests/bug69025.phpt
index 389c09f75f..8cb5f878f2 100644
--- a/Zend/tests/bug69025.phpt
+++ b/Zend/tests/bug69025.phpt
@@ -3,9 +3,9 @@ Bug #69025 (Invalid read of size 4 when calling __callStatic)
--FILE--
<?php
class A {
- public static function __callStatic($method, $args)
- {
- }
+ public static function __callStatic($method, $args)
+ {
+ }
}
A::init();
diff --git a/Zend/tests/bug69084.phpt b/Zend/tests/bug69084.phpt
new file mode 100644
index 0000000000..2cefcc5432
--- /dev/null
+++ b/Zend/tests/bug69084.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #69084: Unclear error message when not implementing a renamed abstract trait function
+--FILE--
+<?php
+
+trait Foo {
+ abstract public function doStuff();
+
+ public function main() {
+ $this->doStuff();
+ }
+}
+
+class Bar {
+ use Foo {
+ Foo::doStuff as doOtherStuff;
+ }
+
+ public function doStuff() {
+ var_dump(__FUNCTION__);
+ }
+}
+
+$b = new Bar();
+$b->main();
+
+?>
+--EXPECTF--
+Fatal error: Class Bar contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Bar::doOtherStuff) in %s on line %d
diff --git a/Zend/tests/bug69092.2.phpt b/Zend/tests/bug69092.2.phpt
index d19116c598..f774820056 100644
--- a/Zend/tests/bug69092.2.phpt
+++ b/Zend/tests/bug69092.2.phpt
@@ -7,7 +7,7 @@ zend.multibyte=0
echo "Hi";
function foo() {
- declare(encoding="UTF-8");
+ declare(encoding="UTF-8");
}
echo "Bye"
diff --git a/Zend/tests/bug69092.phpt b/Zend/tests/bug69092.phpt
index d80954b16f..f1863ccc6b 100644
--- a/Zend/tests/bug69092.phpt
+++ b/Zend/tests/bug69092.phpt
@@ -13,7 +13,7 @@ zend.multibyte=On
echo "Hi";
function foo() {
- declare(encoding="utf-8");
+ declare(encoding="utf-8");
}
echo "Bye"
diff --git a/Zend/tests/bug69124.phpt b/Zend/tests/bug69124.phpt
index 1959332fbf..c704a49b3e 100644
--- a/Zend/tests/bug69124.phpt
+++ b/Zend/tests/bug69124.phpt
@@ -3,13 +3,13 @@ Bug 69124: Method name must be as string (invalid error message when using refer
--FILE--
<?php
class Foo {
- public function bar() {
- print "Success\n";
- }
+ public function bar() {
+ print "Success\n";
+ }
}
function test(&$instance, &$method) {
- $instance->{$method}();
+ $instance->{$method}();
}
$instance = new Foo;
diff --git a/Zend/tests/bug69167.phpt b/Zend/tests/bug69167.phpt
index cae3528406..d75f0500fc 100644
--- a/Zend/tests/bug69167.phpt
+++ b/Zend/tests/bug69167.phpt
@@ -3,7 +3,7 @@ Bug #69167 (call_user_func does not support references anymore)
--FILE--
<?php
function l($m) {
- echo $m . "\n";
+ echo $m . "\n";
}
$cb = 'l';
diff --git a/Zend/tests/bug69174.phpt b/Zend/tests/bug69174.phpt
index eec0957470..8c77cb2563 100644
--- a/Zend/tests/bug69174.phpt
+++ b/Zend/tests/bug69174.phpt
@@ -3,12 +3,12 @@ Bug #69174 (leaks when unused inner class use traits precedence)
--FILE--
<?php
function test() {
- class C1 {
- use T1, T2 {
- T1::foo insteadof T2;
- T1::bar insteadof T2;
- }
- }
+ class C1 {
+ use T1, T2 {
+ T1::foo insteadof T2;
+ T1::bar insteadof T2;
+ }
+ }
}
?>
==DONE==
diff --git a/Zend/tests/bug69201.phpt b/Zend/tests/bug69201.phpt
index 7e2944c49f..7a70912cf0 100644
--- a/Zend/tests/bug69201.phpt
+++ b/Zend/tests/bug69201.phpt
@@ -5,17 +5,17 @@ Bug #69201 (Memory leak using iterator and get by reference on PHP 7)
class Entity
{
- protected $_properties = [];
+ protected $_properties = [];
- public function &__get($property)
- {
- $value = null;
- return $value;
- }
+ public function &__get($property)
+ {
+ $value = null;
+ return $value;
+ }
- public function __set($property, $value)
- {
- }
+ public function __set($property, $value)
+ {
+ }
}
$e = new Entity;
diff --git a/Zend/tests/bug69212.phpt b/Zend/tests/bug69212.phpt
index 5f20faaf4e..418753c3d6 100644
--- a/Zend/tests/bug69212.phpt
+++ b/Zend/tests/bug69212.phpt
@@ -22,17 +22,17 @@ try {
}
try {
- $f = function () {};
- $f->__invoke(do_throw());
+ $f = function () {};
+ $f->__invoke(do_throw());
} catch (Exception $e) {
- echo "Caught!\n";
+ echo "Caught!\n";
}
try {
- $t = new Test;
- $f->__invoke($t->bar(Test::foo(do_throw())));
+ $t = new Test;
+ $f->__invoke($t->bar(Test::foo(do_throw())));
} catch (Exception $e) {
- echo "Caught!\n";
+ echo "Caught!\n";
}
?>
diff --git a/Zend/tests/bug69221.phpt b/Zend/tests/bug69221.phpt
index 72f242f995..a681e5bb68 100644
--- a/Zend/tests/bug69221.phpt
+++ b/Zend/tests/bug69221.phpt
@@ -4,7 +4,7 @@ Bug #69221: Segmentation fault when using a generator in combination with an Ite
<?php
function gen() {
- yield 1;
+ yield 1;
};
$gen1 = gen();
diff --git a/Zend/tests/bug69315.phpt b/Zend/tests/bug69315.phpt
index 296e3bb9c6..82017c0552 100644
--- a/Zend/tests/bug69315.phpt
+++ b/Zend/tests/bug69315.phpt
@@ -7,26 +7,44 @@ disable_functions=strlen,defined,call_user_func,constant,is_string
var_dump(function_exists("strlen"));
var_dump(is_callable("strlen"));
-var_dump(strlen("xxx"));
-var_dump(defined("PHP_VERSION"));
-var_dump(constant("PHP_VERSION"));
-var_dump(call_user_func("strlen"));
-var_dump(is_string("xxx"));
---EXPECTF--
-bool(false)
-bool(true)
-
-Warning: strlen() has been disabled for security reasons in %sbug69315.php on line %d
-NULL
-
-Warning: defined() has been disabled for security reasons in %sbug69315.php on line %d
-NULL
-
-Warning: constant() has been disabled for security reasons in %sbug69315.php on line %d
-NULL
+try {
+ var_dump(strlen("xxx"));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(defined("PHP_VERSION"));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(constant("PHP_VERSION"));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(call_user_func("strlen"));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(is_string("xxx"));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(is_string());
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-Warning: call_user_func() has been disabled for security reasons in %sbug69315.php on line %d
-NULL
-
-Warning: is_string() has been disabled for security reasons in %sbug69315.php on line %d
-NULL
+?>
+--EXPECT--
+bool(false)
+bool(false)
+Call to undefined function strlen()
+Call to undefined function defined()
+Call to undefined function constant()
+Call to undefined function call_user_func()
+Call to undefined function is_string()
+Call to undefined function is_string()
diff --git a/Zend/tests/bug69388.phpt b/Zend/tests/bug69388.phpt
index bf0c0a3c39..c874db715d 100644
--- a/Zend/tests/bug69388.phpt
+++ b/Zend/tests/bug69388.phpt
@@ -3,11 +3,11 @@ Bug #69388: Use after free on recursive calls to PHP compiler
--FILE--
<?php
-function handle_error($code, $message, $file, $line, $context) {
- if (!function_exists("bla")) {
- eval('function bla($s) {echo "$s\n";}');
- }
- bla($message);
+function handle_error($code, $message, $file, $line) {
+ if (!function_exists("bla")) {
+ eval('function bla($s) {echo "$s\n";}');
+ }
+ bla($message);
}
set_error_handler('handle_error');
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/bug69420.phpt b/Zend/tests/bug69420.phpt
index 060d69c839..87f30fb474 100644
--- a/Zend/tests/bug69420.phpt
+++ b/Zend/tests/bug69420.phpt
@@ -4,22 +4,22 @@ Bug #69420 (Invalid read in zend_std_get_method)
<?php
trait T {
- protected function test() {
- echo "okey";
- }
+ protected function test() {
+ echo "okey";
+ }
}
class A {
- protected function test() {
- }
+ protected function test() {
+ }
}
class B extends A {
- use T;
- public function foo() {
- $this->test();
- }
+ use T;
+ public function foo() {
+ $this->test();
+ }
}
diff --git a/Zend/tests/bug69427.phpt b/Zend/tests/bug69427.phpt
index 6b739df961..e482fa85f3 100644
--- a/Zend/tests/bug69427.phpt
+++ b/Zend/tests/bug69427.phpt
@@ -9,15 +9,15 @@ class SubClass extends BaseClass
abstract class BaseClass
{
- public function __call($name, $arguments)
- {
- return $this->$name();
- }
+ public function __call($name, $arguments)
+ {
+ return $this->$name();
+ }
- private function foobar()
- {
- return 'okey';
- }
+ private function foobar()
+ {
+ return 'okey';
+ }
}
$test = new SubClass();
diff --git a/Zend/tests/bug69446.phpt b/Zend/tests/bug69446.phpt
index 66595c170c..a82ecb4472 100644
--- a/Zend/tests/bug69446.phpt
+++ b/Zend/tests/bug69446.phpt
@@ -6,11 +6,11 @@ zend.enable_gc = 1
<?php
$bar = NULL;
class bad {
- public function __destruct() {
- global $bar;
- $bar = $this;
- $bar->y = new stdClass;
- }
+ public function __destruct() {
+ global $bar;
+ $bar = $this;
+ $bar->y = new stdClass;
+ }
}
$foo = new stdClass;
@@ -21,6 +21,7 @@ $foo->bad->x = new stdClass;
unset($foo);
gc_collect_cycles();
var_dump($bar);
+?>
--EXPECT--
object(bad)#2 (2) {
["x"]=>
diff --git a/Zend/tests/bug69446_2.phpt b/Zend/tests/bug69446_2.phpt
index b7c6e0e329..be7dfec021 100644
--- a/Zend/tests/bug69446_2.phpt
+++ b/Zend/tests/bug69446_2.phpt
@@ -7,18 +7,18 @@ zend.enable_gc = 1
$bar = NULL;
class bad
{
- public $_private = array();
+ public $_private = array();
- public function __construct()
- {
- $this->_private[] = 'php';
- }
+ public function __construct()
+ {
+ $this->_private[] = 'php';
+ }
- public function __destruct()
- {
- global $bar;
- $bar = $this;
- }
+ public function __destruct()
+ {
+ global $bar;
+ $bar = $this;
+ }
}
$foo = new stdclass;
@@ -30,6 +30,7 @@ unserialize(serialize($foo));
gc_collect_cycles();
var_dump($bar);
+?>
--EXPECT--
object(bad)#4 (1) {
["_private"]=>
diff --git a/Zend/tests/bug69676.phpt b/Zend/tests/bug69676.phpt
index 54b9d40047..c18eb8f601 100644
--- a/Zend/tests/bug69676.phpt
+++ b/Zend/tests/bug69676.phpt
@@ -3,12 +3,12 @@ Bug #69676: Resolution of self::FOO in class constants not correct
--FILE--
<?php
class A {
- const myConst = "const in A";
- const myDynConst = self::myConst;
+ const myConst = "const in A";
+ const myDynConst = self::myConst;
}
class B extends A {
- const myConst = "const in B";
+ const myConst = "const in B";
}
var_dump(B::myDynConst);
diff --git a/Zend/tests/bug69732.phpt b/Zend/tests/bug69732.phpt
index f5571627fe..7baa71fb63 100644
--- a/Zend/tests/bug69732.phpt
+++ b/Zend/tests/bug69732.phpt
@@ -11,7 +11,7 @@ class wpq {
}
function ret_assoc() {
- $x = "XXX";
+ $x = "XXX";
return array('foo' => 'bar', $x);
}
@@ -19,8 +19,9 @@ $wpq = new wpq;
$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/bug69754.phpt b/Zend/tests/bug69754.phpt
index be55ae2b78..d496b8913e 100644
--- a/Zend/tests/bug69754.phpt
+++ b/Zend/tests/bug69754.phpt
@@ -4,11 +4,11 @@ Bug #69754 (Use of ::class inside array causes compile error)
<?php
class Example {
- public function test() {
- var_dump(static::class);
- var_dump(static::class . 'IsAwesome');
- var_dump(static::class . date('Ymd'));
- var_dump([static::class]);
+ public function test() {
+ var_dump(static::class);
+ var_dump(static::class . 'IsAwesome');
+ var_dump(static::class . date('Ymd'));
+ var_dump([static::class]);
}
}
diff --git a/Zend/tests/bug69755.phpt b/Zend/tests/bug69755.phpt
index 08432808e2..f233f44686 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..5bfa69da15 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/bug69802_2.phpt b/Zend/tests/bug69802_2.phpt
index a2de302707..63346f0afc 100644
--- a/Zend/tests/bug69802_2.phpt
+++ b/Zend/tests/bug69802_2.phpt
@@ -6,7 +6,8 @@ $f = (new ReflectionFunction('iterator_to_array'))->getClosure();
$r = new ReflectionMethod($f, '__invoke');
var_dump($r->getParameters()[0]->getClass());
?>
---EXPECT--
+--EXPECTF--
+Deprecated: Method ReflectionParameter::getClass() is deprecated in %s on line %d
object(ReflectionClass)#4 (1) {
["name"]=>
string(11) "Traversable"
diff --git a/Zend/tests/bug69832.phpt b/Zend/tests/bug69832.phpt
index 5ad88d94bc..503de16422 100644
--- a/Zend/tests/bug69832.phpt
+++ b/Zend/tests/bug69832.phpt
@@ -4,15 +4,15 @@ Bug #69832 (Assertion failed in zend_compile_const_expr_magic_const)
<?php
class Test {
- public $foo = [Bar::A, __CLASS__][__CLASS__ != ""];
- public $bar = Bar::A && __CLASS__;
- public $baz = Bar::A ?: __CLASS__;
- public $buzz = Bar::A ? __CLASS__ : 0;
+ public $foo = [Bar::A, __CLASS__][__CLASS__ != ""];
+ public $bar = Bar::A && __CLASS__;
+ public $baz = Bar::A ?: __CLASS__;
+ public $buzz = Bar::A ? __CLASS__ : 0;
}
eval(<<<'PHP'
class Bar {
- const A = 1;
+ const A = 1;
}
PHP
);
diff --git a/Zend/tests/bug69871.phpt b/Zend/tests/bug69871.phpt
index f77be25885..937cee796a 100644
--- a/Zend/tests/bug69871.phpt
+++ b/Zend/tests/bug69871.phpt
@@ -1,15 +1,13 @@
--TEST--
Bug #69871 (Short-circuiting failure with smart_branch)
---INI--
-opcache.enable=0
--FILE--
<?php
$a = true;
if (isset($a) && 0) {
- var_dump(true);
+ var_dump(true);
} else {
- var_dump(false);
+ var_dump(false);
}
?>
diff --git a/Zend/tests/bug69891.phpt b/Zend/tests/bug69891.phpt
index f4b30948de..97cf2e15ee 100644
--- a/Zend/tests/bug69891.phpt
+++ b/Zend/tests/bug69891.phpt
@@ -6,6 +6,7 @@ Bug #69891: Unexpected array comparison result
var_dump([1, 2, 3] <=> []);
var_dump([] <=> [1, 2, 3]);
var_dump([1] <=> [2, 3]);
+?>
--EXPECT--
int(1)
int(-1)
diff --git a/Zend/tests/bug69955.phpt b/Zend/tests/bug69955.phpt
index ece96a88ad..1c8340af2c 100644
--- a/Zend/tests/bug69955.phpt
+++ b/Zend/tests/bug69955.phpt
@@ -25,6 +25,7 @@ class C10 implements ArrayAccess
$c10 = new C10;
var_dump($c10[] += 5);
+?>
--EXPECT--
Inside C10::offsetGet
NULL
diff --git a/Zend/tests/bug69957.phpt b/Zend/tests/bug69957.phpt
index 01b024e778..d72d588978 100644
--- a/Zend/tests/bug69957.phpt
+++ b/Zend/tests/bug69957.phpt
@@ -4,79 +4,82 @@ Bug #69957 (Different ways of handling div/mod by zero)
<?php
try {
- $divisor = 0;
- $result = 1 / $divisor;
- var_dump($result);
+ $divisor = 0;
+ $result = 1 / $divisor;
+ var_dump($result);
} catch (DivisionByZeroError $t){
- echo "Variable div\n";
- printf("Type: %s\n", get_class($t));
- printf("Message: %s\n", $t->getMessage());
+ echo "Variable div\n";
+ printf("Type: %s\n", get_class($t));
+ printf("Message: %s\n", $t->getMessage());
}
try {
- $divisor = 0;
- $result = 1 % $divisor;
- var_dump($result);
+ $divisor = 0;
+ $result = 1 % $divisor;
+ var_dump($result);
} catch (DivisionByZeroError $t){
- echo "\nVariable mod\n";
- printf("Type: %s\n", get_class($t));
- printf("Message: %s\n", $t->getMessage());
+ echo "\nVariable mod\n";
+ printf("Type: %s\n", get_class($t));
+ printf("Message: %s\n", $t->getMessage());
}
try {
- $result = 1 / 0;
- var_dump($result);
+ $result = 1 / 0;
+ var_dump($result);
} catch (DivisionByZeroError $t){
- echo "\nLiteral div\n";
- printf("Type: %s\n", get_class($t));
- printf("Message: %s\n", $t->getMessage());
+ echo "\nLiteral div\n";
+ printf("Type: %s\n", get_class($t));
+ printf("Message: %s\n", $t->getMessage());
}
try {
- $result = 1 % 0;
- var_dump($result);
+ $result = 1 % 0;
+ var_dump($result);
} catch (DivisionByZeroError $t){
- echo "\nLiteral mod\n";
- printf("Type: %s\n", get_class($t));
- printf("Message: %s\n", $t->getMessage());
+ echo "\nLiteral mod\n";
+ printf("Type: %s\n", get_class($t));
+ printf("Message: %s\n", $t->getMessage());
}
try {
- $result = 1 / 0.0;
- var_dump($result);
+ $result = 1 / 0.0;
+ var_dump($result);
} catch (DivisionByZeroError $t){
- echo "\nDouble div\n";
- printf("Type: %s\n", get_class($t));
- printf("Message: %s\n", $t->getMessage());
+ echo "\nDouble div\n";
+ printf("Type: %s\n", get_class($t));
+ printf("Message: %s\n", $t->getMessage());
}
try {
- $result = 1 % 0.0;
- var_dump($result);
+ $result = 1 % 0.0;
+ var_dump($result);
} catch (DivisionByZeroError $t){
- echo "\nDouble mod\n";
- printf("Type: %s\n", get_class($t));
- printf("Message: %s\n", $t->getMessage());
+ echo "\nDouble mod\n";
+ printf("Type: %s\n", get_class($t));
+ printf("Message: %s\n", $t->getMessage());
}
?>
---EXPECTF--
-Warning: Division by zero in %sbug69957.php on line %d
-float(INF)
+--EXPECT--
+Variable div
+Type: DivisionByZeroError
+Message: Division by zero
Variable mod
Type: DivisionByZeroError
Message: Modulo by zero
-Warning: Division by zero in %sbug69957.php on line %d
-float(INF)
+Literal div
+Type: DivisionByZeroError
+Message: Division by zero
Literal mod
Type: DivisionByZeroError
Message: Modulo by zero
-Warning: Division by zero in %sbug69957.php on line %d
-float(INF)
+Double div
+Type: DivisionByZeroError
+Message: Division by zero
Double mod
Type: DivisionByZeroError
diff --git a/Zend/tests/bug69996.phpt b/Zend/tests/bug69996.phpt
index 178e36837a..f9044677cd 100644
--- a/Zend/tests/bug69996.phpt
+++ b/Zend/tests/bug69996.phpt
@@ -4,17 +4,17 @@ Bug #69996 (Changing the property of a cloned object affects the original)
<?php
function method($cache) {
- $prepared = clone $cache;
- var_dump($prepared->data);
- $prepared->data = "bad";
- return $prepared;
+ $prepared = clone $cache;
+ var_dump($prepared->data);
+ $prepared->data = "bad";
+ return $prepared;
}
$cache = new stdClass();
$cache->data = "good";
for ($i = 0; $i < 5; ++$i) {
- method($cache);
+ method($cache);
}
?>
--EXPECT--
diff --git a/Zend/tests/bug70012.phpt b/Zend/tests/bug70012.phpt
index 9e532218a9..3892fefcf2 100644
--- a/Zend/tests/bug70012.phpt
+++ b/Zend/tests/bug70012.phpt
@@ -3,23 +3,23 @@ Bug #70012 (Exception lost with nested finally block)
--FILE--
<?php
try {
- echo "Outer try\n";
- try {
- echo " Middle try\n";
- throw new Exception();
- } finally {
- echo " Middle finally\n";
- try {
- echo " Inner try\n";
- } finally {
- echo " Inner finally\n";
- }
- }
- echo "Outer shouldn't get here\n";
+ echo "Outer try\n";
+ try {
+ echo " Middle try\n";
+ throw new Exception();
+ } finally {
+ echo " Middle finally\n";
+ try {
+ echo " Inner try\n";
+ } finally {
+ echo " Inner finally\n";
+ }
+ }
+ echo "Outer shouldn't get here\n";
} catch (Exception $e) {
- echo "Outer catch\n";
+ echo "Outer catch\n";
} finally {
- echo "Outer finally\n";
+ echo "Outer finally\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/bug70083.phpt b/Zend/tests/bug70083.phpt
index 5bc3656e9f..691e6a4125 100644
--- a/Zend/tests/bug70083.phpt
+++ b/Zend/tests/bug70083.phpt
@@ -4,10 +4,10 @@ Bug #70083 (Use after free with assign by ref to overloaded objects)
<?php
class foo {
- private $var;
- function __get($e) {
- return $this;
- }
+ private $var;
+ function __get($e) {
+ return $this;
+ }
}
function &noref() { $foo = 1; return $foo; }
diff --git a/Zend/tests/bug70089.phpt b/Zend/tests/bug70089.phpt
index 1bfc38ae09..d2bf14fb7e 100644
--- a/Zend/tests/bug70089.phpt
+++ b/Zend/tests/bug70089.phpt
@@ -1,33 +1,31 @@
--TEST--
Bug #70089 (segfault in PHP 7 at ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER ())
---INI--
-opcache.enable=0
--FILE--
<?php
function dummy($a) {
}
try {
- chr(0)[0][] = 1;
+ chr(0)[0][] = 1;
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
- unset(chr(0)[0][0]);
+ unset(chr(0)[0][0]);
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
eval("function runtimetest(&\$a) {} ");
try {
- runtimetest(chr(0)[0]);
+ runtimetest(chr(0)[0]);
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
- ++chr(0)[0];
+ ++chr(0)[0];
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
--EXPECT--
diff --git a/Zend/tests/bug70117.phpt b/Zend/tests/bug70117.phpt
index 4bdd12caef..51b77457ab 100644
--- a/Zend/tests/bug70117.phpt
+++ b/Zend/tests/bug70117.phpt
@@ -4,18 +4,19 @@ Bug #70117 (Unexpected return type error)
<?php
function &foo() :string {
- $a = array(1);
- $b = &$a[0];
- return $b;
+ $a = array(1);
+ $b = &$a[0];
+ return $b;
}
function &foo1() :string {
- $a = array("ref");
- return $a[0];
+ $a = array("ref");
+ return $a[0];
}
var_dump(foo());
var_dump(foo1());
+?>
--EXPECT--
string(1) "1"
string(3) "ref"
diff --git a/Zend/tests/bug70121.phpt b/Zend/tests/bug70121.phpt
index 9f8b7d6055..5b4aaa3a76 100644
--- a/Zend/tests/bug70121.phpt
+++ b/Zend/tests/bug70121.phpt
@@ -5,5 +5,9 @@ Bug #70121 (unserialize() could lead to unexpected methods execution / NULL poin
unserialize('O:12:"DateInterval":1:{s:4:"days";O:9:"Exception":7:{s:10:"'."\0".'*'."\0".'message";s:1:"x";s:17:"'."\0".'Exception'."\0".'string";s:1:"A";s:7:"'."\0".'*'."\0".'code";i:0;s:7:"'."\0".'*'."\0".'file";s:1:"a";s:7:"'."\0".'*'."\0".'line";i:1337;s:16:"'."\0".'Exception'."\0".'trace";a:0:{}s:19:"'."\0".'Exception'."\0".'previous";O:8:"stdClass":0:{}}}');
?>
OK
---EXPECT--
-OK
+--EXPECTF--
+Fatal error: Uncaught TypeError: Cannot assign stdClass to property Exception::$previous of type ?Throwable in %s:%d
+Stack trace:
+#0 %s(%d): unserialize('O:12:"DateInter...')
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug70124.phpt b/Zend/tests/bug70124.phpt
index f32a8613fe..51f592d24d 100644
--- a/Zend/tests/bug70124.phpt
+++ b/Zend/tests/bug70124.phpt
@@ -4,43 +4,43 @@ Bug #70124 (null ptr deref / seg fault in ZEND_HANDLE_EXCEPTION_SPEC_HANDLER)
<?php
try {
- echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),$f("test"))],chr(48));
+ echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),$f("test"))],chr(48));
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
class A {
}
try {
- echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),a::y("test"))],chr(48));
+ echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),a::y("test"))],chr(48));
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
$a = new A;
try {
- echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),$a->y("test"))],chr(48));
+ echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),$a->y("test"))],chr(48));
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
- echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),\bar\y("test"))],chr(48));
+ echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),\bar\y("test"))],chr(48));
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
- echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),y("test"))],chr(48));
+ echo base_convert([array_search(chr(48),chr(48),chr(48),chr(48),chr(48),y("test"))],chr(48));
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
--EXPECTF--
-Notice: Undefined variable: f in %sbug70124.php on line %d
-string(30) "Function name must be a string"
+Warning: Undefined variable $f in %s on line %d
+string(34) "Value of type null is not callable"
string(31) "Call to undefined method A::y()"
string(31) "Call to undefined method A::y()"
string(34) "Call to undefined function bar\y()"
diff --git a/Zend/tests/bug70156.phpt b/Zend/tests/bug70156.phpt
index 6b5e383337..0d20b38181 100644
--- a/Zend/tests/bug70156.phpt
+++ b/Zend/tests/bug70156.phpt
@@ -3,30 +3,30 @@ Bug #70156 (Segfault in zend_find_alias_name)
--FILE--
<?php
trait T1 {
- protected function foo1()
- {
- $this->bar();
- }
+ protected function foo1()
+ {
+ $this->bar();
+ }
}
trait T2 {
- protected function foo2()
- {
- debug_print_backtrace();
- }
+ protected function foo2()
+ {
+ debug_print_backtrace();
+ }
}
class dummy {
- use T1 {
- foo1 as private;
- }
- use T2 {
- foo2 as bar;
- }
- public function __construct()
- {
- $this->foo1();
- }
+ use T1 {
+ foo1 as private;
+ }
+ use T2 {
+ foo2 as bar;
+ }
+ public function __construct()
+ {
+ $this->foo1();
+ }
}
new dummy();
diff --git a/Zend/tests/bug70164.phpt b/Zend/tests/bug70164.phpt
index 7777be4ee0..b8053b241f 100644
--- a/Zend/tests/bug70164.phpt
+++ b/Zend/tests/bug70164.phpt
@@ -4,14 +4,14 @@ __COMPILER_HALT_OFFSET__ is a "magic" constant, which should work if referenced
<?php
namespace {
- echo __COMPILER_HALT_OFFSET__, "\n";
- echo \__COMPILER_HALT_OFFSET__, "\n";
+ echo __COMPILER_HALT_OFFSET__, "\n";
+ echo \__COMPILER_HALT_OFFSET__, "\n";
}
namespace Foo {
- echo __COMPILER_HALT_OFFSET__, "\n";
- echo \__COMPILER_HALT_OFFSET__, "\n";
- echo namespace\__COMPILER_HALT_OFFSET__, "\n";
+ echo __COMPILER_HALT_OFFSET__, "\n";
+ echo \__COMPILER_HALT_OFFSET__, "\n";
+ echo namespace\__COMPILER_HALT_OFFSET__, "\n";
}
@@ -24,7 +24,7 @@ __halt_compiler();
%d
%d
-Fatal error: Uncaught Error: Undefined constant 'Foo\__COMPILER_HALT_OFFSET__' in %s:%d
+Fatal error: Uncaught Error: Undefined constant "Foo\__COMPILER_HALT_OFFSET__" in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug70179.phpt b/Zend/tests/bug70179.phpt
index a5bdb98805..7ab924eedb 100644
--- a/Zend/tests/bug70179.phpt
+++ b/Zend/tests/bug70179.phpt
@@ -4,9 +4,9 @@ Bug #70179 ($this refcount issue)
<?php
class X {
- function __invoke() {
- var_dump($this);
- }
+ function __invoke() {
+ var_dump($this);
+ }
}
(new X)();
diff --git a/Zend/tests/bug70187.phpt b/Zend/tests/bug70187.phpt
index a30f13b3ea..a675fff507 100644
--- a/Zend/tests/bug70187.phpt
+++ b/Zend/tests/bug70187.phpt
@@ -3,7 +3,7 @@ Bug #70187 (Notice: unserialize(): Unexpected end of serialized data)
--FILE--
<?php
class A {
- public $b;
+ public $b;
}
$a = new A;
diff --git a/Zend/tests/bug70215.phpt b/Zend/tests/bug70215.phpt
index 527920cbb5..50c1d057ca 100644
--- a/Zend/tests/bug70215.phpt
+++ b/Zend/tests/bug70215.phpt
@@ -4,9 +4,9 @@ Bug #70215 (Segfault when invoke is static)
<?php
class A {
- public static function __invoke() {
- echo __CLASS__;
- }
+ public static function __invoke() {
+ echo __CLASS__;
+ }
}
class B extends A { }
@@ -17,5 +17,4 @@ $b();
?>
--EXPECTF--
-Warning: The magic method __invoke() must have public visibility and cannot be static in %s on line %d
-A
+Fatal error: Method A::__invoke() cannot be static in %s on line %d
diff --git a/Zend/tests/bug70241.phpt b/Zend/tests/bug70241.phpt
index 74218e9bf9..bc3729982f 100644
--- a/Zend/tests/bug70241.phpt
+++ b/Zend/tests/bug70241.phpt
@@ -6,8 +6,8 @@ zend.assertions=-1
<?php
function foo () {
- assert(yield 1);
- return null;
+ assert(yield 1);
+ return null;
}
var_dump(foo() instanceof Generator);
diff --git a/Zend/tests/bug70258.phpt b/Zend/tests/bug70258.phpt
index 5ffd7bf512..40915a286e 100644
--- a/Zend/tests/bug70258.phpt
+++ b/Zend/tests/bug70258.phpt
@@ -6,19 +6,19 @@ memory_limit=2M
<?php
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
if ($zend_mm_enabled === "0") {
- die("skip Zend MM disabled");
+ die("skip Zend MM disabled");
}
?>
--FILE--
<?php
class A {
- public $arr;
- public function core() {
- $this->arr["no_pack"] = 1;
- while (1) {
- $this->arr[] = 1;
- }
- }
+ public $arr;
+ public function core() {
+ $this->arr["no_pack"] = 1;
+ while (1) {
+ $this->arr[] = 1;
+ }
+ }
}
$a = new A;
diff --git a/Zend/tests/bug70288.phpt b/Zend/tests/bug70288.phpt
index 4b55d0b476..502bfc7bf0 100644
--- a/Zend/tests/bug70288.phpt
+++ b/Zend/tests/bug70288.phpt
@@ -3,13 +3,13 @@ Bug #70288 (Apache crash related to ZEND_SEND_REF)
--FILE--
<?php
class A {
- public function __get($name) {
- return new Stdclass();
- }
+ public function __get($name) {
+ return new Stdclass();
+ }
}
function test(&$obj) {
- var_dump($obj);
+ var_dump($obj);
}
$a = new A;
test($a->dummy);
diff --git a/Zend/tests/bug70321.phpt b/Zend/tests/bug70321.phpt
index 19f691f418..6e490555be 100644
--- a/Zend/tests/bug70321.phpt
+++ b/Zend/tests/bug70321.phpt
@@ -4,27 +4,27 @@ bug #70321 (Magic getter breaks reference to array property)
<?php
class foo implements arrayAccess
{
- private $bar;
- public function __construct()
- {
- $this->bar = new bar();
- }
- public function & __get($key)
- {
- $bar = $this->bar;
- return $bar;
- }
+ private $bar;
+ public function __construct()
+ {
+ $this->bar = new bar();
+ }
+ public function & __get($key)
+ {
+ $bar = $this->bar;
+ return $bar;
+ }
- public function & offsetGet($key) {
- $bar = $this->bar;
- return $bar;
- }
- public function offsetSet($key, $val) {
- }
- public function offsetUnset($key) {
- }
- public function offsetExists($key) {
- }
+ public function & offsetGet($key) {
+ $bar = $this->bar;
+ return $bar;
+ }
+ public function offsetSet($key, $val) {
+ }
+ public function offsetUnset($key) {
+ }
+ public function offsetExists($key) {
+ }
}
class bar { public $onBaz = []; }
diff --git a/Zend/tests/bug70332.phpt b/Zend/tests/bug70332.phpt
index 217070f133..f078a65a2f 100644
--- a/Zend/tests/bug70332.phpt
+++ b/Zend/tests/bug70332.phpt
@@ -3,7 +3,7 @@ Bug #70332 (Wrong behavior while returning reference on object)
--FILE--
<?php
function & test($arg) {
- return $arg;
+ return $arg;
}
$arg = new Stdclass();
diff --git a/Zend/tests/bug70430.phpt b/Zend/tests/bug70430.phpt
index 59983653e9..1577a00587 100644
--- a/Zend/tests/bug70430.phpt
+++ b/Zend/tests/bug70430.phpt
@@ -7,4 +7,4 @@ $"*** Testing function() : ***\n";
?>
--EXPECTF--
-Parse error: syntax error, unexpected '"*** Testing function() : ***' (T_CONSTANT_ENCAPSED_STRING), expecting variable (T_VARIABLE) or '{' or '$' in %s on line %d
+Parse error: syntax error, unexpected double-quoted string "*** Testing function() : ***\n", expecting variable or "{" or "$" in %s on line %d
diff --git a/Zend/tests/bug70478.phpt b/Zend/tests/bug70478.phpt
index 1785a97324..eb58cde36b 100644
--- a/Zend/tests/bug70478.phpt
+++ b/Zend/tests/bug70478.phpt
@@ -4,12 +4,12 @@ Bug #70478 (**= does no longer work)
<?php
class foo {
- public $a = 3;
- private $b = 4;
+ public $a = 3;
+ private $b = 4;
- function __construct() {
- $this->a **= $this->b;
- }
+ function __construct() {
+ $this->a **= $this->b;
+ }
}
$a = new foo;
diff --git a/Zend/tests/bug70547.phpt b/Zend/tests/bug70547.phpt
index f793e70781..e8ebfe9dc9 100644
--- a/Zend/tests/bug70547.phpt
+++ b/Zend/tests/bug70547.phpt
@@ -3,29 +3,29 @@ Bug #70547 (unsetting function variables corrupts backtrace)
--FILE--
<?php
function brokenTrace($arg1, &$arg2, $arg3){
- backtraceWrapper();
- var_dump(func_get_args());
- unset($arg3);
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
- var_dump(func_get_arg(2));
- var_dump(func_get_arg(3));
- backtraceWrapper();
- unset($arg1);
- var_dump(func_get_args());
- backtraceWrapper();
- unset($arg2);
- backtraceWrapper();
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
- var_dump(func_get_arg(2));
- var_dump(func_get_arg(3));
+ backtraceWrapper();
+ var_dump(func_get_args());
+ unset($arg3);
+ var_dump(func_get_arg(0));
+ var_dump(func_get_arg(1));
+ var_dump(func_get_arg(2));
+ var_dump(func_get_arg(3));
+ backtraceWrapper();
+ unset($arg1);
+ var_dump(func_get_args());
+ backtraceWrapper();
+ unset($arg2);
+ backtraceWrapper();
+ var_dump(func_get_arg(0));
+ var_dump(func_get_arg(1));
+ var_dump(func_get_arg(2));
+ var_dump(func_get_arg(3));
}
$arg2 = "2nd";
brokenTrace("1st", $arg2, "3th", "4th");
function backtraceWrapper(){
- $bt = debug_backtrace();
- var_dump($bt[1]['args']);
+ $bt = debug_backtrace();
+ var_dump($bt[1]['args']);
}
?>
--EXPECT--
@@ -33,7 +33,7 @@ array(4) {
[0]=>
string(3) "1st"
[1]=>
- &string(3) "2nd"
+ string(3) "2nd"
[2]=>
string(3) "3th"
[3]=>
@@ -57,7 +57,7 @@ array(4) {
[0]=>
string(3) "1st"
[1]=>
- &string(3) "2nd"
+ string(3) "2nd"
[2]=>
NULL
[3]=>
@@ -77,7 +77,7 @@ array(4) {
[0]=>
NULL
[1]=>
- &string(3) "2nd"
+ string(3) "2nd"
[2]=>
NULL
[3]=>
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/bug70689.phpt b/Zend/tests/bug70689.phpt
index 882dd89b75..d1895cf39e 100644
--- a/Zend/tests/bug70689.phpt
+++ b/Zend/tests/bug70689.phpt
@@ -4,17 +4,17 @@ Bug #70689 (Exception handler does not work as expected)
<?php
function foo($foo) {
- echo "Executing foo\n";
+ echo "Executing foo\n";
}
set_error_handler(function($errno, $errstr) {
- throw new Exception($errstr);
+ throw new Exception($errstr);
});
try {
- foo();
+ foo();
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
?>
diff --git a/Zend/tests/bug70785.phpt b/Zend/tests/bug70785.phpt
index f48bc3cdb9..05b1b6afa0 100644
--- a/Zend/tests/bug70785.phpt
+++ b/Zend/tests/bug70785.phpt
@@ -4,19 +4,19 @@ Bug #70785 (Infinite loop due to exception during identical comparison)
<?php
set_error_handler(function($no, $msg) {
- throw new Exception($msg);
+ throw new Exception($msg);
});
try {
- if ($a === null) { // ZEND_VM_SMART_BRANCH
- undefined_function('Null');
- }
+ if ($a === null) { // ZEND_VM_SMART_BRANCH
+ undefined_function('Null');
+ }
} catch (Exception $e) {
}
try {
- $c === 3; // ZEND_VM_NEXT_OPCODE
- undefined_function();
+ $c === 3; // ZEND_VM_NEXT_OPCODE
+ undefined_function();
} catch (Exception $e) {
}
?>
diff --git a/Zend/tests/bug70805.phpt b/Zend/tests/bug70805.phpt
index 1177233184..86c8a2c800 100644
--- a/Zend/tests/bug70805.phpt
+++ b/Zend/tests/bug70805.phpt
@@ -9,12 +9,12 @@ class B {
}
class C {
- public function __destruct() {
- if (isset($GLOBALS["a"])) {
- unset($GLOBALS["array"]);
- unset($GLOBALS["a"]); // this will be called in gc_colloct_roots and put $a into gc roots buf
- }
- }
+ public function __destruct() {
+ if (isset($GLOBALS["a"])) {
+ unset($GLOBALS["array"]);
+ unset($GLOBALS["a"]); // this will be called in gc_colloct_roots and put $a into gc roots buf
+ }
+ }
}
$a = new A;
@@ -28,9 +28,9 @@ $array = array($c); //This is used to leave a room for $GLOBALS["a"]
unset($c);
while ($i++ < 9998) {
- $t = [];
- $t[] = &$t;
- unset($t);
+ $t = [];
+ $t[] = &$t;
+ unset($t);
}
$t = [new C];
$t[] = &$t;
@@ -39,7 +39,7 @@ unset($t); // This is used to trigger C::__destruct while doing gc_colloct_roots
$e = $a;
unset($a); // This one can not be putted into roots buf because it's full, thus gc_colloct_roots will be called,
// but C::__destructor which is called in gc_colloct_roots will put $a into buf
- // which will make $a be putted into gc roots buf twice
+ // which will make $a be putted into gc roots buf twice
var_dump(gc_collect_cycles());
?>
--EXPECT--
diff --git a/Zend/tests/bug70805_1.phpt b/Zend/tests/bug70805_1.phpt
index 035ec6884f..7d699e25e3 100644
--- a/Zend/tests/bug70805_1.phpt
+++ b/Zend/tests/bug70805_1.phpt
@@ -11,12 +11,12 @@ class B {
}
class C {
- public function __destruct() {
- if (isset($GLOBALS["a"])) {
- unset($GLOBALS["array"]);
- unset($GLOBALS["a"]);
- }
- }
+ public function __destruct() {
+ if (isset($GLOBALS["a"])) {
+ unset($GLOBALS["array"]);
+ unset($GLOBALS["a"]);
+ }
+ }
}
$a = new A;
@@ -30,9 +30,9 @@ $array = array($c);
unset($c);
while ($i++ < 9998) {
- $t = [];
- $t[] = &$t;
- unset($t);
+ $t = [];
+ $t[] = &$t;
+ unset($t);
}
$t = [new C];
$t[] = &$t;
diff --git a/Zend/tests/bug70805_2.phpt b/Zend/tests/bug70805_2.phpt
index a4d01aa626..4bbc3347ec 100644
--- a/Zend/tests/bug70805_2.phpt
+++ b/Zend/tests/bug70805_2.phpt
@@ -11,11 +11,11 @@ class B {
}
class C {
- public function __destruct() {
- if (isset($GLOBALS["a"])) {
- unset($GLOBALS["a"]);
- }
- }
+ public function __destruct() {
+ if (isset($GLOBALS["a"])) {
+ unset($GLOBALS["a"]);
+ }
+ }
}
$a = new A;
@@ -25,9 +25,9 @@ $a->b->a = $a;
$i = 0;
while ($i++ < 9999) {
- $t = [];
- $t[] = &$t;
- unset($t);
+ $t = [];
+ $t[] = &$t;
+ unset($t);
}
$t = [new C];
$t[] = &$t;
@@ -35,5 +35,6 @@ unset($t);
unset($a);
var_dump(gc_collect_cycles());
+?>
--EXPECT--
int(2)
diff --git a/Zend/tests/bug70873.phpt b/Zend/tests/bug70873.phpt
index aecc0e879b..fd6274c4d2 100644
--- a/Zend/tests/bug70873.phpt
+++ b/Zend/tests/bug70873.phpt
@@ -4,19 +4,19 @@ Bug #70873 (Regression on private static properties access)
<?php
class A {
- private static $x = 1;
+ private static $x = 1;
}
class B extends A {
- function bar() {
- var_dump(self::$x);
- }
+ function bar() {
+ var_dump(self::$x);
+ }
};
class C extends A {
- function bar() {
- var_dump(A::$x);
- }
+ function bar() {
+ var_dump(A::$x);
+ }
};
diff --git a/Zend/tests/bug70895.phpt b/Zend/tests/bug70895.phpt
index 896bf00a7b..1a28d9ef5c 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(): Argument #1 ($callback) must be a valid callback, function "%n" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback, function "%n %i" not found or invalid function name
+array_map(): Argument #1 ($callback) must 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..2aff5109d8 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(): Argument #1 ($callback) must be a valid callback, function "0000000000000000000000000000000000" not found or invalid function name
diff --git a/Zend/tests/bug70912.phpt b/Zend/tests/bug70912.phpt
index 3d6d4303a6..912ffc601e 100644
--- a/Zend/tests/bug70912.phpt
+++ b/Zend/tests/bug70912.phpt
@@ -3,7 +3,7 @@ Bug #70912 (Null ptr dereference when class property is initialised to a derefer
--FILE--
<?php
class A {
- public $a=[][];
+ public $a=[][];
}
?>
--EXPECTF--
diff --git a/Zend/tests/bug70914.phpt b/Zend/tests/bug70914.phpt
index 0382076efb..d1f4279312 100644
--- a/Zend/tests/bug70914.phpt
+++ b/Zend/tests/bug70914.phpt
@@ -3,7 +3,7 @@ Bug #70914 zend_throw_or_error() format string vulnerability
--SKIPIF--
<?php
if (!extension_loaded("pdo_sqlite")) {
- die("skip pdo_sqlite required");
+ die("skip pdo_sqlite required");
}
?>
--FILE--
@@ -11,7 +11,11 @@ if (!extension_loaded("pdo_sqlite")) {
$db = new PDO('sqlite::memory:');
$st = $db->query('SELECT 1');
-$re = $st->fetchObject('%Z');
+try {
+ $re = $st->fetchObject('%Z');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTREGEX--
-Fatal error: Class '%Z' not found in .+bug70914.php on line \d+
+--EXPECT--
+PDOStatement::fetchObject(): Argument #1 ($class) must be a valid class name, %Z given
diff --git a/Zend/tests/bug70918.phpt b/Zend/tests/bug70918.phpt
index 81e2192d8a..54f3a3c72a 100644
--- a/Zend/tests/bug70918.phpt
+++ b/Zend/tests/bug70918.phpt
@@ -3,45 +3,45 @@ Bug #70918 (Segfault using static outside of class scope)
--FILE--
<?php
try {
- static::x;
+ static::x;
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
- parent::x;
+ parent::x;
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
- self::x;
+ self::x;
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
- new static;
+ new static;
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
- static::x();
+ static::x();
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
- static::$i;
+ static::$i;
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
--EXPECT--
-string(52) "Cannot access static:: when no class scope is active"
-string(52) "Cannot access parent:: when no class scope is active"
-string(50) "Cannot access self:: when no class scope is active"
-string(52) "Cannot access static:: when no class scope is active"
-string(52) "Cannot access static:: when no class scope is active"
-string(52) "Cannot access static:: when no class scope is active"
+string(52) "Cannot access "static" when no class scope is active"
+string(52) "Cannot access "parent" when no class scope is active"
+string(50) "Cannot access "self" when no class scope is active"
+string(52) "Cannot access "static" when no class scope is active"
+string(52) "Cannot access "static" when no class scope is active"
+string(52) "Cannot access "static" when no class scope is active"
diff --git a/Zend/tests/bug70944.phpt b/Zend/tests/bug70944.phpt
index afb10bc27f..6a617f5e46 100644
--- a/Zend/tests/bug70944.phpt
+++ b/Zend/tests/bug70944.phpt
@@ -3,25 +3,25 @@ Bug #70944 (try{ } finally{} can create infinite chains of exceptions)
--FILE--
<?php
try {
- $e = new Exception("Foo");
- try {
- throw new Exception("Bar", 0, $e);
- } finally {
- throw $e;
- }
+ $e = new Exception("Foo");
+ try {
+ throw new Exception("Bar", 0, $e);
+ } finally {
+ throw $e;
+ }
} catch (Exception $e) {
- var_dump((string)$e);
+ var_dump((string)$e);
}
try {
- $e = new Exception("Foo");
- try {
- throw new Exception("Bar", 0, $e);
- } finally {
- throw new Exception("Dummy", 0, $e);
- }
+ $e = new Exception("Foo");
+ try {
+ throw new Exception("Bar", 0, $e);
+ } finally {
+ throw new Exception("Dummy", 0, $e);
+ }
} catch (Exception $e) {
- var_dump((string)$e);
+ var_dump((string)$e);
}
?>
--EXPECTF--
diff --git a/Zend/tests/bug70957.phpt b/Zend/tests/bug70957.phpt
index 7db7d7d023..39970f9123 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 %s on line %d
diff --git a/Zend/tests/bug70958.phpt b/Zend/tests/bug70958.phpt
index faa75e0b16..5a0d605ad3 100644
--- a/Zend/tests/bug70958.phpt
+++ b/Zend/tests/bug70958.phpt
@@ -4,13 +4,13 @@ Bug #70958 (Invalid opcode while using ::class as trait method parameter default
<?php
trait Foo
{
- function bar($a = self::class) {
- var_dump($a);
- }
+ function bar($a = self::class) {
+ var_dump($a);
+ }
}
class B {
- use Foo;
+ use Foo;
}
$b = new B;
diff --git a/Zend/tests/bug70967.phpt b/Zend/tests/bug70967.phpt
index d254ea8d89..03f3021e39 100644
--- a/Zend/tests/bug70967.phpt
+++ b/Zend/tests/bug70967.phpt
@@ -3,9 +3,9 @@ Bug #70967 (Weird error handling for __toString when Error is thrown)
--FILE--
<?php
class A {
- public function __toString() {
- undefined_function();
- }
+ public function __toString() {
+ undefined_function();
+ }
}
echo (new A);
diff --git a/Zend/tests/bug70997.phpt b/Zend/tests/bug70997.phpt
index 119eb6cbbe..286d4bccfa 100644
--- a/Zend/tests/bug70997.phpt
+++ b/Zend/tests/bug70997.phpt
@@ -22,5 +22,6 @@ class B extends A {
$b = new B;
$b->test();
+?>
--EXPECT--
bool(true)
diff --git a/Zend/tests/bug71067.phpt b/Zend/tests/bug71067.phpt
index b2a1b31811..9528f1fec9 100644
--- a/Zend/tests/bug71067.phpt
+++ b/Zend/tests/bug71067.phpt
@@ -1,18 +1,17 @@
--TEST--
Bug #71067 (Local object in class method stays in memory for each call)
--INI--
-opcache.enable=0
error_reporting=0
--FILE--
<?php
class Test {
- public function test(){
- $arr = (object) [
- 'children' => []
- ];
- $arr->children[] = 1;
- return $arr;
- }
+ public function test(){
+ $arr = (object) [
+ 'children' => []
+ ];
+ $arr->children[] = 1;
+ return $arr;
+ }
}
$o = new Test();
diff --git a/Zend/tests/bug71163.phpt b/Zend/tests/bug71163.phpt
index f87b951480..71470027ba 100644
--- a/Zend/tests/bug71163.phpt
+++ b/Zend/tests/bug71163.phpt
@@ -3,20 +3,20 @@ Bug #71163 (Segmentation Fault (cleanup_unfinished_calls))
--FILE--
<?php
spl_autoload_register(function ($name) {
- eval ("class $name extends Exception { public static function foo() {}}");
- throw new Exception("boom");
+ eval ("class $name extends Exception { public static function foo() {}}");
+ throw new Exception("boom");
});
function test2() {
- try {
- Test::foo();
- } catch (Exception $e) {
- echo "okey";
- }
+ try {
+ Test::foo();
+ } catch (Exception $e) {
+ echo "okey";
+ }
}
function test() {
- test2();
+ test2();
}
test();
diff --git a/Zend/tests/bug71221.phpt b/Zend/tests/bug71221.phpt
index 0f6ee16946..4a3819ba04 100644
--- a/Zend/tests/bug71221.phpt
+++ b/Zend/tests/bug71221.phpt
@@ -2,9 +2,11 @@
Bug #71221 (Null pointer deref (segfault) in get_defined_vars via ob_start)
--FILE--
<?php
-ob_start("get_defined_vars");
-ob_end_clean();
+register_shutdown_function("get_defined_vars");
?>
-okey
--EXPECT--
-okey
+Fatal error: Uncaught Error: Cannot call get_defined_vars() dynamically in [no active file]:0
+Stack trace:
+#0 [internal function]: get_defined_vars()
+#1 {main}
+ thrown in [no active file] on line 0
diff --git a/Zend/tests/bug71275.phpt b/Zend/tests/bug71275.phpt
index 52443734b7..efca70ba5c 100644
--- a/Zend/tests/bug71275.phpt
+++ b/Zend/tests/bug71275.phpt
@@ -4,18 +4,18 @@ Bug #71275 (Bad method called on cloning an object having a trait)
<?php
trait MyTrait {
- public function _() {
- throw new RuntimeException('Should not be called');
- }
+ public function _() {
+ throw new RuntimeException('Should not be called');
+ }
}
class MyClass {
- use MyTrait;
+ use MyTrait;
- public function __clone() {
- echo "I'm working hard to clone";
- }
+ public function __clone() {
+ echo "I'm working hard to clone";
+ }
}
diff --git a/Zend/tests/bug71300.phpt b/Zend/tests/bug71300.phpt
index 3589c4764e..40734b0549 100644
--- a/Zend/tests/bug71300.phpt
+++ b/Zend/tests/bug71300.phpt
@@ -3,20 +3,20 @@ Bug #71300 (Segfault in zend_fetch_string_offset)
--FILE--
<?php
function test1() {
- for ($n = 'a'; $n < 'g'; $n++) {
- $$n = 1;
- }
- $$n = $$n[++$n] = "test";
- return $$n;
+ for ($n = 'a'; $n < 'g'; $n++) {
+ $$n = 1;
+ }
+ $$n = $$n[++$n] = "test";
+ return $$n;
}
var_dump(test1());
function test2() {
/* See #71303 for why not using for loop here */
- $n = "a";
- $$n .= $$n[++$n] = "test";
- return $$n;
+ $n = "a";
+ $$n .= $$n[++$n] = "test";
+ return $$n;
}
var_dump(test2());
@@ -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/bug71336.phpt b/Zend/tests/bug71336.phpt
index c5da420da0..bf38224235 100644
--- a/Zend/tests/bug71336.phpt
+++ b/Zend/tests/bug71336.phpt
@@ -4,23 +4,23 @@ Bug #71336 (Wrong is_ref on properties as exposed via get_object_vars())
<?php
class A
{
- protected $bar = array('baz');
+ protected $bar = array('baz');
- function bar()
- {
- array_pop($this->bar);
- $vars = get_object_vars($this);
- $this->bar[] = array('buz');
- print_r($vars);
- }
+ function bar()
+ {
+ array_pop($this->bar);
+ $vars = get_object_vars($this);
+ $this->bar[] = array('buz');
+ print_r($vars);
+ }
- function foo() {
- array_pop($this->bar);
- $dummy = &$this->bar;
- $vars = get_object_vars($this);
- $this->bar[] = array('buz');
- print_r($vars);
- }
+ function foo() {
+ array_pop($this->bar);
+ $dummy = &$this->bar;
+ $vars = get_object_vars($this);
+ $this->bar[] = array('buz');
+ print_r($vars);
+ }
}
(new A())->bar();
diff --git a/Zend/tests/bug71414.phpt b/Zend/tests/bug71414.phpt
index 09f8b7dd32..ca1b761982 100644
--- a/Zend/tests/bug71414.phpt
+++ b/Zend/tests/bug71414.phpt
@@ -21,5 +21,6 @@ class Y extends X implements InterfaceY {
}
echo "ok";
+?>
--EXPECT--
ok
diff --git a/Zend/tests/bug71428.1.phpt b/Zend/tests/bug71428.1.phpt
index 490fc30070..be7c7f4826 100644
--- a/Zend/tests/bug71428.1.phpt
+++ b/Zend/tests/bug71428.1.phpt
@@ -8,5 +8,6 @@ class A {
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 = []) must be compatible with A::m(?array $a = null) in %s on line %d
diff --git a/Zend/tests/bug71428.2.phpt b/Zend/tests/bug71428.2.phpt
index 9fc15fc8c5..9cc7304e4a 100644
--- a/Zend/tests/bug71428.2.phpt
+++ b/Zend/tests/bug71428.2.phpt
@@ -5,13 +5,13 @@ bug #71428.2: inheritance of ye olde dynamic interfaces
--FILE--
<?php
interface StatementInterface {
- public function fetch($first = null, $second, $third);
+ public function fetch(int $first = PDO::FETCH_BOTH, int $second = PDO::FETCH_ORI_NEXT, int $third = 0);
}
class Statement extends PDOStatement implements StatementInterface {}
interface StatementInterface1 {
- public function fetch($first = null, $second = null, $third = null);
+ public function fetch(int $first = PDO::FETCH_ASSOC, int $second = PDO::FETCH_ORI_PRIOR, int $third = 1);
}
class Statement1 extends PDOStatement implements StatementInterface1 {}
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/bug71474.phpt b/Zend/tests/bug71474.phpt
index 72b0db91a1..5000377237 100644
--- a/Zend/tests/bug71474.phpt
+++ b/Zend/tests/bug71474.phpt
@@ -3,17 +3,17 @@ Bug #71474: Crash because of VM stack corruption on Magento2
--FILE--
<?php
class foo {
- function __call($name, $args) {
- $a = $b = $c = $d = $e = $f = 1;
- }
+ function __call($name, $args) {
+ $a = $b = $c = $d = $e = $f = 1;
+ }
}
function test($n, $x) {
// var_dump($n);
- if ($n > 0) {
- $x->bug();
- test($n - 1, $x);
- }
+ if ($n > 0) {
+ $x->bug();
+ test($n - 1, $x);
+ }
}
test(3000, new foo());
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/bug71572.phpt b/Zend/tests/bug71572.phpt
index f4f44449cd..f4079e55f8 100644
--- a/Zend/tests/bug71572.phpt
+++ b/Zend/tests/bug71572.phpt
@@ -4,24 +4,31 @@ Bug #71572: String offset assignment from an empty string inserts null byte
<?php
$str = "abc";
-var_dump($str[0] = "");
-var_dump($str[1] = "");
-var_dump($str[3] = "");
-var_dump($str[10] = "");
+try {
+ var_dump($str[0] = "");
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump($str[1] = "");
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump($str[3] = "");
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump($str[10] = "");
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump($str);
?>
-==DONE==
---EXPECTF--
-Warning: Cannot assign an empty string to a string offset in %s on line %d
-NULL
-
-Warning: Cannot assign an empty string to a string offset in %s on line %d
-NULL
-
-Warning: Cannot assign an empty string to a string offset in %s on line %d
-NULL
-
-Warning: Cannot assign an empty string to a string offset in %s on line %d
-NULL
+--EXPECT--
+Cannot assign an empty string to a string offset
+Cannot assign an empty string to a string offset
+Cannot assign an empty string to a string offset
+Cannot assign an empty string to a string offset
string(3) "abc"
-==DONE==
diff --git a/Zend/tests/bug71622.phpt b/Zend/tests/bug71622.phpt
index 3ef0ba80e1..c23547788a 100644
--- a/Zend/tests/bug71622.phpt
+++ b/Zend/tests/bug71622.phpt
@@ -4,22 +4,22 @@ Bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$calla
<?php
function getMethodName(&$methodName) {
- $methodName = Abc::METHOD_NAME;
+ $methodName = Abc::METHOD_NAME;
}
class Abc {
- const METHOD_NAME = "goal";
+ const METHOD_NAME = "goal";
- private static function goal() {
- echo "success\n";
- }
+ private static function goal() {
+ echo "success\n";
+ }
- public static function run() {
- $method = "foobar";
- getMethodName($method);
- var_dump(is_callable("self::$method"));
- self::$method();
- }
+ public static function run() {
+ $method = "foobar";
+ getMethodName($method);
+ var_dump(is_callable("self::$method"));
+ self::$method();
+ }
}
Abc::run();
diff --git a/Zend/tests/bug71695.phpt b/Zend/tests/bug71695.phpt
index 6747ce0e14..31ae73a99d 100644
--- a/Zend/tests/bug71695.phpt
+++ b/Zend/tests/bug71695.phpt
@@ -3,9 +3,9 @@ Bug #71695 (Global variables are reserved before execution)
--FILE--
<?php
function provideGlobals() {
- var_dump(array_key_exists("foo", $GLOBALS));
- var_dump(isset($GLOBALS["foo"]));
- $GLOBALS += array("foo" => "foo");
+ var_dump(array_key_exists("foo", $GLOBALS));
+ var_dump(isset($GLOBALS["foo"]));
+ $GLOBALS += array("foo" => "foo");
}
provideGlobals();
diff --git a/Zend/tests/bug71756.phpt b/Zend/tests/bug71756.phpt
index 1f43c082f0..9bf88c0792 100644
--- a/Zend/tests/bug71756.phpt
+++ b/Zend/tests/bug71756.phpt
@@ -3,20 +3,20 @@ Bug #71756 (Call-by-reference widens scope to uninvolved functions when used in
--FILE--
<?php
function a ($option) {
- b($option['bla']);
- c($option);
- var_dump($option);
+ b($option['bla']);
+ c($option);
+ var_dump($option);
}
function b (&$string) {
- $string = 'changed';
+ $string = 'changed';
}
function c ($option) {
- switch ($option['bla']) {
- case 'changed':
- $copy = $option;
- $copy['bla'] = 'copy';
- break;
- }
+ switch ($option['bla']) {
+ case 'changed':
+ $copy = $option;
+ $copy['bla'] = 'copy';
+ break;
+ }
}
a(array('bla' => 'false'));
?>
diff --git a/Zend/tests/bug71841.phpt b/Zend/tests/bug71841.phpt
index f66761b3c9..f32b0e9b23 100644
--- a/Zend/tests/bug71841.phpt
+++ b/Zend/tests/bug71841.phpt
@@ -1,23 +1,45 @@
--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++);
+try {
+ var_dump($z->e.=0);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(++$z->x);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($z->y++);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$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
+The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
+The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
+The script tried to modify a property on an incomplete object. Please ensure that the class definition "A" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition
+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/bug71914.phpt b/Zend/tests/bug71914.phpt
index a43eb56bbd..d7cae342f6 100644
--- a/Zend/tests/bug71914.phpt
+++ b/Zend/tests/bug71914.phpt
@@ -4,26 +4,26 @@ Bug #71914 (Reference is lost in "switch")
<?php
function bug(&$value) {
- switch ($value) {
- case "xxxx":
- $value = true;
- break;
- }
+ switch ($value) {
+ case "xxxx":
+ $value = true;
+ break;
+ }
}
function returnArray() {
- $array = array();
- $array["str"] = "xxxx";
- return $array;
+ $array = array();
+ $array["str"] = "xxxx";
+ return $array;
}
class Foo {
- public $array = array("str" => "xxxx");
+ public $array = array("str" => "xxxx");
}
function test($arr, &$dummy) {
- bug($arr["str"]);
- var_dump($arr["str"]);
+ bug($arr["str"]);
+ var_dump($arr["str"]);
}
$foo = new Foo();
diff --git a/Zend/tests/bug71930.phpt b/Zend/tests/bug71930.phpt
index 4604b88493..1aa64bf583 100644
--- a/Zend/tests/bug71930.phpt
+++ b/Zend/tests/bug71930.phpt
@@ -3,15 +3,15 @@ Bug #71930 (_zval_dtor_func: Assertion `(arr)->gc.refcount <= 1' failed)
--SKIPIF--
<?php
if (!extension_loaded("curl")) {
- die("skip Require a resource which is able to hold a callbck");
+ die("skip Require a resource which is able to hold a callback");
}
?>
--FILE--
<?php
class A {
- public static function dummy() {
- }
+ public static function dummy() {
+ }
}
$a = array();
diff --git a/Zend/tests/bug72038.phpt b/Zend/tests/bug72038.phpt
index 9ce82268c1..201fbbf40b 100644
--- a/Zend/tests/bug72038.phpt
+++ b/Zend/tests/bug72038.phpt
@@ -3,10 +3,19 @@ Bug #72038 (Function calls with values to a by-ref parameter don't always throw
--FILE--
<?php
-test($foo = new stdClass);
-var_dump($foo);
-test($bar = 2);
-var_dump($bar);
+try {
+ test($foo = new stdClass);
+ var_dump($foo);
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ test($bar = 2);
+ var_dump($bar);
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
test($baz = &$bar);
var_dump($baz);
@@ -15,11 +24,7 @@ function test(&$param) {
}
?>
---EXPECTF--
-Notice: Only variables should be passed by reference in %s on line %d
-object(stdClass)#1 (0) {
-}
-
-Notice: Only variables should be passed by reference in %s on line %d
-int(2)
+--EXPECT--
+test(): Argument #1 ($param) cannot be passed by reference
+test(): Argument #1 ($param) cannot be passed by reference
int(1)
diff --git a/Zend/tests/bug72057.phpt b/Zend/tests/bug72057.phpt
deleted file mode 100644
index 406efe3efc..0000000000
--- a/Zend/tests/bug72057.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Bug #72057 (PHP hangs when user error handler throws exception after Notice from type coercion)
---FILE--
-<?php
-
-set_error_handler(
- function() {
- throw new Exception("My custom error");
- }
-);
-
-(function (int $i) { bar(); })("7as");
---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)
-#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..6951e88cf3 100644
--- a/Zend/tests/bug72101.phpt
+++ b/Zend/tests/bug72101.phpt
@@ -73,10 +73,11 @@ $OuterMatcher->methodNameMatcher = null;
$OuterMatcher->stub = new PHPUnit_Framework_MockObject_Stub_ReturnCallback([$foo, 'callback']);
$a = $b = $c = 0;
$foo->bar($a, $b, $c);
+?>
--EXPECTF--
-Fatal error: Uncaught Error: Class 'DoesNotExists' not found in %sbug72101.php:61
+Fatal error: Uncaught Error: Class "DoesNotExists" not found in %s:%d
Stack trace:
-#0 %sbug72101.php(8): {closure}(2, 'Parameter 1 to ...', '%s', 8, Array)
+#0 %sbug72101.php(8): {closure}(2, 'MethodCallbackB...', '%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..f65b142269 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--
+func_get_args() expects exactly 0 arguments, 4 given
diff --git a/Zend/tests/bug72119.phpt b/Zend/tests/bug72119.phpt
index 7afac3cd5b..b374bcc007 100644
--- a/Zend/tests/bug72119.phpt
+++ b/Zend/tests/bug72119.phpt
@@ -15,4 +15,4 @@ class Hello implements Foo {
echo "OK\n";
?>
--EXPECTF--
-Fatal error: Declaration of Hello::bar(array $baz = Array) must be compatible with Foo::bar(?array $baz = NULL) in %s on line %d
+Fatal error: Declaration of Hello::bar(array $baz = []) must be compatible with Foo::bar(?array $baz = null) in %s on line %d
diff --git a/Zend/tests/bug72162.phpt b/Zend/tests/bug72162.phpt
index 44237038a1..721b0fc306 100644
--- a/Zend/tests/bug72162.phpt
+++ b/Zend/tests/bug72162.phpt
@@ -4,11 +4,12 @@ Bug #72162 (use-after-free - error_reporting)
<?php
error_reporting(E_ALL);
$var11 = new StdClass();
-$var16 = error_reporting($var11);
+
+try {
+ $var16 = error_reporting($var11);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
---EXPECTF--
-Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in %s:%d
-Stack trace:
-#0 %s(%d): error_reporting(Object(stdClass))
-#1 {main}
- thrown in %s on line %d
+--EXPECT--
+error_reporting(): Argument #1 ($error_level) must be of type ?int, stdClass given
diff --git a/Zend/tests/bug72215_2.phpt b/Zend/tests/bug72215_2.phpt
index cefb6d9632..029bf874fe 100644
--- a/Zend/tests/bug72215_2.phpt
+++ b/Zend/tests/bug72215_2.phpt
@@ -8,7 +8,7 @@ function &test(&$b) {
return $a;
} finally {
$a =& $c;
- $a = 2;
+ $a = 2;
}
}
$x = 1;
diff --git a/Zend/tests/bug72441.phpt b/Zend/tests/bug72441.phpt
index af57b3adb0..8e0a12a1c5 100644
--- a/Zend/tests/bug72441.phpt
+++ b/Zend/tests/bug72441.phpt
@@ -6,8 +6,8 @@ Bug #72441 (Segmentation fault: RFC list_keys)
$array = [];
list(
- '' => $foo,
- $bar
+ '' => $foo,
+ $bar
) = $array;
?>
--EXPECTF--
diff --git a/Zend/tests/bug72496.phpt b/Zend/tests/bug72496.phpt
index 62e55cb561..5ba67bfa6d 100644
--- a/Zend/tests/bug72496.phpt
+++ b/Zend/tests/bug72496.phpt
@@ -39,5 +39,6 @@ class Bar extends Foo
}
echo "OK\n";
+?>
--EXPECT--
OK
diff --git a/Zend/tests/bug72508.phpt b/Zend/tests/bug72508.phpt
index b39aa16d02..86ad749a40 100644
--- a/Zend/tests/bug72508.phpt
+++ b/Zend/tests/bug72508.phpt
@@ -3,20 +3,20 @@ Bug #72508 (strange references after recursive function call and "switch" statem
--FILE--
<?php
function a ($option) {
- b($option['bla']);
- c($option);
- var_dump($option);
+ b($option['bla']);
+ c($option);
+ var_dump($option);
}
function b (&$string) {
- $string = 'changed';
+ $string = 'changed';
}
function c ($option) {
- switch ($option['bla']) {
- default:
- $copy = $option;
- $copy['bla'] = 'copy';
- break;
- }
+ switch ($option['bla']) {
+ default:
+ $copy = $option;
+ $copy['bla'] = 'copy';
+ break;
+ }
}
a(array('bla' => 'fasel'));
diff --git a/Zend/tests/bug72594.phpt b/Zend/tests/bug72594.phpt
index c67e68e4ac..42ac1f38a1 100644
--- a/Zend/tests/bug72594.phpt
+++ b/Zend/tests/bug72594.phpt
@@ -1,16 +1,14 @@
--TEST--
Bug #72594 (Calling an earlier instance of an included anonymous class fatals)
---INI--
-opcache.enable=0
--FILE--
<?php
if (isset($runtime)) {
- return new class {
- public $bar;
- public function bing($foo = null) {
- if ($foo) $foo->bing();
- }
- };
+ return new class {
+ public $bar;
+ public function bing($foo = null) {
+ if ($foo) $foo->bing();
+ }
+ };
}
$runtime = 1;
diff --git a/Zend/tests/bug72598.phpt b/Zend/tests/bug72598.phpt
index dfb09a05b8..741abc35e2 100644
--- a/Zend/tests/bug72598.phpt
+++ b/Zend/tests/bug72598.phpt
@@ -3,7 +3,7 @@ Bug #72598 (Reference is lost after array_slice())
--FILE--
<?php
function ref(&$ref) {
- var_dump($ref);
+ var_dump($ref);
}
new class {
@@ -17,10 +17,10 @@ new class {
};
?>
--EXPECTF--
-Warning: Parameter 1 to ref() expected to be a reference, value given in %sbug72598.php on line 11
+Warning: ref(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d
object(class@anonymous)#1 (0) {
}
-Warning: Parameter 1 to ref() expected to be a reference, value given in %sbug72598.php on line 11
+Warning: ref(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d
object(class@anonymous)#1 (0) {
}
diff --git a/Zend/tests/bug72598_2.phpt b/Zend/tests/bug72598_2.phpt
index c3943806ff..9a9274aae4 100644
--- a/Zend/tests/bug72598_2.phpt
+++ b/Zend/tests/bug72598_2.phpt
@@ -3,15 +3,15 @@ Bug #72598.2 (Reference is lost after array_slice())
--FILE--
<?php
function ref(&$ref) {
- var_dump($ref);
- $ref = 1;
+ var_dump($ref);
+ $ref = 1;
}
new class {
function __construct() {
- $b = 0;
+ $b = 0;
$args = [&$b];
- unset($b);
+ unset($b);
for ($i = 0; $i < 2; $i++) {
$a = array_slice($args, 0, 1);
call_user_func_array('ref', $a);
@@ -20,8 +20,8 @@ new class {
};
?>
--EXPECTF--
-Warning: Parameter 1 to ref() expected to be a reference, value given in %sbug72598_2.php on line 14
+Warning: ref(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d
int(0)
-Warning: Parameter 1 to ref() expected to be a reference, value given in %sbug72598_2.php on line 14
+Warning: ref(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d
int(0)
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/bug72918.phpt b/Zend/tests/bug72918.phpt
index 403d4e69c5..92ee518de5 100644
--- a/Zend/tests/bug72918.phpt
+++ b/Zend/tests/bug72918.phpt
@@ -13,10 +13,8 @@ $string[-3]
EOT;
?>
-===DONE===
--EXPECT--
foo
c
foo
c
-===DONE===
diff --git a/Zend/tests/bug72943.phpt b/Zend/tests/bug72943.phpt
index 8bab6de456..01c921b3b6 100644
--- a/Zend/tests/bug72943.phpt
+++ b/Zend/tests/bug72943.phpt
@@ -12,9 +12,9 @@ $a[0] = "t";
var_dump($array[$a]);
?>
--EXPECTF--
-Notice: Undefined index: lest in %sbug72943.php on line %d
+Warning: Undefined array key "lest" in %s on line %d
NULL
-Notice: Undefined index: fest in %sbug72943.php on line %d
+Warning: Undefined array key "fest" in %s on line %d
NULL
int(1)
diff --git a/Zend/tests/bug72944.phpt b/Zend/tests/bug72944.phpt
index 0ee8bd62c6..b5c76be3ae 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/bug73288.phpt b/Zend/tests/bug73288.phpt
index fefcf3bbcd..52e8eedeaf 100644
--- a/Zend/tests/bug73288.phpt
+++ b/Zend/tests/bug73288.phpt
@@ -7,20 +7,20 @@ opcache.enable_cli=1
<?php
class NoClone {
- public function __clone() {
- throw new Exception("No Cloneable");
- }
+ public function __clone() {
+ throw new Exception("No Cloneable");
+ }
}
class C {
- public function __get($name) {
- return new NoClone;
- }
+ public function __get($name) {
+ return new NoClone;
+ }
}
function test_clone() {
- $c = new C;
- $b = clone $c->x;
+ $c = new C;
+ $b = clone $c->x;
}
test_clone();
diff --git a/Zend/tests/bug73337.phpt b/Zend/tests/bug73337.phpt
index 53ce963c52..a338aa605c 100644
--- a/Zend/tests/bug73337.phpt
+++ b/Zend/tests/bug73337.phpt
@@ -5,8 +5,5 @@ Bug #73337 (try/catch not working with two exceptions inside a same operation)
class d { function __destruct() { throw new Exception; } }
try { new d + new d; } catch (Exception $e) { print "Exception properly caught\n"; }
?>
---EXPECTF--
-Notice: Object of class d could not be converted to number in %sbug73337.php on line 3
-
-Notice: Object of class d could not be converted to number in %sbug73337.php on line 3
+--EXPECT--
Exception properly caught
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/bug73663.phpt b/Zend/tests/bug73663.phpt
index 06dd7f6700..85b61b0f46 100644
--- a/Zend/tests/bug73663.phpt
+++ b/Zend/tests/bug73663.phpt
@@ -3,12 +3,12 @@ Bug #73663 ("Invalid opcode 65/16/8" occurs with a variable created with list())
--FILE--
<?php
function change(&$ref) {
- $ref = range(1, 10);
- return;
+ $ref = range(1, 10);
+ return;
}
$func = function (&$ref) {
- return change($ref);
+ return change($ref);
};
$array = [1];
diff --git a/Zend/tests/bug73663_2.phpt b/Zend/tests/bug73663_2.phpt
index 660a4f845e..31592f255f 100644
--- a/Zend/tests/bug73663_2.phpt
+++ b/Zend/tests/bug73663_2.phpt
@@ -3,8 +3,8 @@ Bug #73663.2 ("Invalid opcode 65/16/8" occurs with a variable created with list(
--FILE--
<?php
function change(&$ref) {
- $ref = range(1, 10);
- return;
+ $ref = range(1, 10);
+ return;
}
$array = [1];
@@ -12,4 +12,7 @@ change(list($val) = $array);
var_dump($array);
?>
--EXPECTF--
-Fatal error: Only variables can be passed by reference in %s on line %d
+Fatal error: Uncaught Error: change(): Argument #1 ($ref) cannot be passed by reference in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug73792.phpt b/Zend/tests/bug73792.phpt
index ac4f265aaf..39e45f1367 100644
--- a/Zend/tests/bug73792.phpt
+++ b/Zend/tests/bug73792.phpt
@@ -4,15 +4,15 @@ Bug #73792 (invalid foreach loop hangs script)
<?php
$a = 'aaa';
-foreach ($a['bbb'] as &$value) {
- echo 'loop';
+foreach ($a['2bbb'] as &$value) {
+ echo 'loop';
}
unset($value);
echo 'done';
?>
--EXPECTF--
-Warning: Illegal string offset 'bbb' in %sbug73792.php on line 4
+Warning: Illegal string offset "2bbb" in %s on line %d
Fatal error: Uncaught Error: Cannot iterate on string offsets by reference in %sbug73792.php:4
Stack trace:
diff --git a/Zend/tests/bug73916.phpt b/Zend/tests/bug73916.phpt
index ba2567ed0c..7b51f8f31a 100644
--- a/Zend/tests/bug73916.phpt
+++ b/Zend/tests/bug73916.phpt
@@ -9,7 +9,7 @@ $test[] =& $a;
$test[] =& $b;
test($test);
function test() {
- debug_print_backtrace();
+ debug_print_backtrace();
}
?>
--EXPECTF--
diff --git a/Zend/tests/bug73954.phpt b/Zend/tests/bug73954.phpt
index fb0a6b8f3d..bff81f5001 100644
--- a/Zend/tests/bug73954.phpt
+++ b/Zend/tests/bug73954.phpt
@@ -16,7 +16,7 @@ takes_int(log(tan(3.14)));
float(NAN)
bool(true)
-Fatal error: Uncaught TypeError: Argument 1 passed to takes_int() must be of the type int, float given, called in %s on line 9 and defined in %s:6
+Fatal error: Uncaught TypeError: takes_int(): Argument #1 ($int) must be of type int, float given, called in %s:%d
Stack trace:
#0 %s(9): takes_int(NAN)
#1 {main}
diff --git a/Zend/tests/bug73987.phpt b/Zend/tests/bug73987.phpt
index 610b594a64..7875be77da 100644
--- a/Zend/tests/bug73987.phpt
+++ b/Zend/tests/bug73987.phpt
@@ -15,4 +15,4 @@ class B extends A {
?>
--EXPECTF--
-Fatal error: Declaration of B::example($a, $b, $c = NULL) must be compatible with A::example($a, $b = NULL, $c = NULL) in %s
+Fatal error: Declaration of B::example($a, $b, $c = null) must be compatible with A::example($a, $b = null, $c = null) in %s on line %d
diff --git a/Zend/tests/bug73987_2.phpt b/Zend/tests/bug73987_2.phpt
index a70f1455e8..f6861fa4da 100644
--- a/Zend/tests/bug73987_2.phpt
+++ b/Zend/tests/bug73987_2.phpt
@@ -17,4 +17,4 @@ class C extends B {
?>
--EXPECTF--
-Fatal error: Declaration of C::example($a, $b, $c = NULL) must be compatible with B::example($a, $b = NULL, $c = NULL) in %s
+Fatal error: Declaration of C::example($a, $b, $c = null) must be compatible with B::example($a, $b = null, $c = null) in %s on line %d
diff --git a/Zend/tests/bug73989.phpt b/Zend/tests/bug73989.phpt
index 48e5a7a734..04d776cb9e 100644
--- a/Zend/tests/bug73989.phpt
+++ b/Zend/tests/bug73989.phpt
@@ -8,13 +8,13 @@ class Cycle
public function __construct()
{
- $obj = $this;
+ $obj = $this;
$this->thing = function() use($obj) {};
}
public function __destruct()
{
- ($this->thing)();
+ ($this->thing)();
}
}
diff --git a/Zend/tests/bug74053.phpt b/Zend/tests/bug74053.phpt
index b1936a58e9..16d430405b 100644
--- a/Zend/tests/bug74053.phpt
+++ b/Zend/tests/bug74053.phpt
@@ -4,7 +4,7 @@ Bug #74053 (Corrupted class entries on shutdown when a destructor spawns another
<?php
class b {
function __destruct() {
- echo "b::destruct\n";
+ echo "b::destruct\n";
}
}
class a {
@@ -12,10 +12,10 @@ class a {
static $new;
static $max = 10;
function __destruct() {
- if (self::$max-- <= 0) return;
- echo "a::destruct\n";
- self::$b = new b;
- self::$new[] = new a;
+ if (self::$max-- <= 0) return;
+ echo "a::destruct\n";
+ self::$b = new b;
+ self::$new[] = new a;
}
}
new a;
diff --git a/Zend/tests/bug74084.phpt b/Zend/tests/bug74084.phpt
index 2e65471bcc..36239438c6 100644
--- a/Zend/tests/bug74084.phpt
+++ b/Zend/tests/bug74084.phpt
@@ -4,16 +4,34 @@ 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;
-var_dump($$A);
+try {
+ $$A **= $$B['a'] = &$$C;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECT--
-int(1)
+Unsupported operand types: array - array
+Unsupported operand types: array * array
+Unsupported operand types: array / array
+Unsupported operand types: array ** array
diff --git a/Zend/tests/bug74164.phpt b/Zend/tests/bug74164.phpt
index 354b2f51e0..36d681290d 100644
--- a/Zend/tests/bug74164.phpt
+++ b/Zend/tests/bug74164.phpt
@@ -6,13 +6,13 @@ Bug #74164 (PHP hangs when an invalid value is dynamically passed to typehinted
namespace Foo;
set_error_handler(function ($type, $msg) {
- throw new \Exception($msg);
+ throw new \Exception($msg);
});
call_user_func(function (array &$ref) {var_dump("xxx");}, 'not_an_array_variable');
?>
--EXPECTF--
-Fatal error: Uncaught Exception: Parameter 1 to Foo\{closure}() expected to be a reference, value given in %sbug74164.php:%d
+Fatal error: Uncaught Exception: Foo\{closure}(): Argument #1 ($ref) must be passed by reference, value given in %s:%d
Stack trace:
#0 [internal function]: Foo\{closure}(%s)
#1 %sbug74164.php(%d): call_user_func(%s)
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/bug74546.phpt b/Zend/tests/bug74546.phpt
index 2efa790766..f2e08c950c 100644
--- a/Zend/tests/bug74546.phpt
+++ b/Zend/tests/bug74546.phpt
@@ -5,7 +5,7 @@ Bug #74546 (SIGILL in ZEND_FETCH_CLASS_CONSTANT_SPEC_CONST_CONST_HANDLER())
"000000"[0]::d;
?>
--EXPECTF--
-Fatal error: Uncaught Error: Class '0' not found in %sbug74546.php:%d
+Fatal error: Uncaught Error: Class "0" not found in %s:%d
Stack trace:
#0 {main}
thrown in %sbug74546.php on line %d
diff --git a/Zend/tests/bug74657.phpt b/Zend/tests/bug74657.phpt
index 4c84bde7bd..055501066b 100644
--- a/Zend/tests/bug74657.phpt
+++ b/Zend/tests/bug74657.phpt
@@ -7,19 +7,19 @@ interface I {
}
class C {
- const FOO = I::FOO;
+ const FOO = I::FOO;
- public $options = [self::FOO => "bar"];
+ public $options = [self::FOO => "bar"];
}
try {
- var_dump((new C)->options);
+ var_dump((new C)->options);
} catch (Throwable $e) {}
var_dump((new C)->options);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined class constant 'I::FOO' in %sbug74657.php:%d
+Fatal error: Uncaught Error: Undefined constant I::FOO in %s:%d
Stack trace:
#0 {main}
thrown in %sbug74657.php on line %d
diff --git a/Zend/tests/bug74836.phpt b/Zend/tests/bug74836.phpt
index 7281a07e0e..53b3775260 100644
--- a/Zend/tests/bug74836.phpt
+++ b/Zend/tests/bug74836.phpt
@@ -24,10 +24,10 @@ bool(true)
string(2) "42"
bool(true)
-Notice: Undefined index: 010 in %s on line %d
+Warning: Undefined array key "010" in %s on line %d
NULL
bool(false)
-Notice: Undefined index: 010 in %s on line %d
+Warning: Undefined array key "010" in %s on line %d
NULL
bool(false)
diff --git a/Zend/tests/bug74840.phpt b/Zend/tests/bug74840.phpt
index 68e27cba84..713e7908dd 100644
--- a/Zend/tests/bug74840.phpt
+++ b/Zend/tests/bug74840.phpt
@@ -4,13 +4,13 @@ Bug #74840: Opcache overwrites argument of GENERATOR_RETURN within finally
<?php
$g = (function($a) {
- try {
- return $a + 1;
- } finally {
- $b = $a + 2;
- var_dump($b);
- }
- yield; // Generator
+ try {
+ return $a + 1;
+ } finally {
+ $b = $a + 2;
+ var_dump($b);
+ }
+ yield; // Generator
})(1);
$g->next();
var_dump($g->getReturn());
diff --git a/Zend/tests/bug75241.phpt b/Zend/tests/bug75241.phpt
index 1751bbee76..334c30b6ff 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" on null in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug75252.phpt b/Zend/tests/bug75252.phpt
index 16679e4d6e..b4e0a1b5bd 100644
--- a/Zend/tests/bug75252.phpt
+++ b/Zend/tests/bug75252.phpt
@@ -24,5 +24,5 @@ try {
?>
--EXPECT--
-string(41) "syntax error, unexpected 'FOO' (T_STRING)"
-string(41) "syntax error, unexpected 'FOO' (T_STRING)"
+string(41) "syntax error, unexpected identifier "FOO""
+string(41) "syntax error, unexpected identifier "FOO""
diff --git a/Zend/tests/bug75290.phpt b/Zend/tests/bug75290.phpt
index 3b28e621d2..9d9d1a0561 100644
--- a/Zend/tests/bug75290.phpt
+++ b/Zend/tests/bug75290.phpt
@@ -12,7 +12,7 @@ var_dump(function ($someThing) {});
object(Closure)#2 (1) {
["parameter"]=>
array(1) {
- ["$number"]=>
+ ["$num"]=>
string(10) "<required>"
}
}
diff --git a/Zend/tests/bug75420.1.phpt b/Zend/tests/bug75420.1.phpt
index 80e951ac9e..fe7fbabcc5 100644
--- a/Zend/tests/bug75420.1.phpt
+++ b/Zend/tests/bug75420.1.phpt
@@ -3,8 +3,8 @@ Bug #75420.1 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
- public function __isset($x) { $GLOBALS["name"] = 24; return true; }
- public function __get($x) { var_dump($x); return 42; }
+ public function __isset($x) { $GLOBALS["name"] = 24; return true; }
+ public function __get($x) { var_dump($x); return 42; }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.10.phpt b/Zend/tests/bug75420.10.phpt
index c2ae3aa55d..224a6494c9 100644
--- a/Zend/tests/bug75420.10.phpt
+++ b/Zend/tests/bug75420.10.phpt
@@ -3,10 +3,10 @@ Bug #75420.10 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
- public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
- public function offsetGet($x) { var_dump($x); return 42; }
- public function offsetSet($x, $y) { }
- public function offsetUnset($x) { }
+ public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
+ public function offsetGet($x) { var_dump($x); return 42; }
+ public function offsetSet($x, $y) { }
+ public function offsetUnset($x) { }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.11.phpt b/Zend/tests/bug75420.11.phpt
index 1ec623e41c..d4b5a9a6d1 100644
--- a/Zend/tests/bug75420.11.phpt
+++ b/Zend/tests/bug75420.11.phpt
@@ -3,10 +3,10 @@ Bug #75420.11 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
- public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
- public function offsetGet($x) { var_dump($x); return 42; }
- public function offsetSet($x, $y) { }
- public function offsetUnset($x) { }
+ public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
+ public function offsetGet($x) { var_dump($x); return 42; }
+ public function offsetSet($x, $y) { }
+ public function offsetUnset($x) { }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.12.phpt b/Zend/tests/bug75420.12.phpt
index 7ed6f1474b..93567e069d 100644
--- a/Zend/tests/bug75420.12.phpt
+++ b/Zend/tests/bug75420.12.phpt
@@ -3,10 +3,10 @@ Bug #75420.12 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
- public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
- public function offsetGet($x) { var_dump($x); return 42; }
- public function offsetSet($x, $y) { }
- public function offsetUnset($x) { }
+ public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
+ public function offsetGet($x) { var_dump($x); return 42; }
+ public function offsetSet($x, $y) { }
+ public function offsetUnset($x) { }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.13.phpt b/Zend/tests/bug75420.13.phpt
index 38031badd7..2526021ded 100644
--- a/Zend/tests/bug75420.13.phpt
+++ b/Zend/tests/bug75420.13.phpt
@@ -3,10 +3,10 @@ Bug #75420.13 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
- public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; }
- public function offsetGet($x) { var_dump($x); return 42; }
- public function offsetSet($x, $y) { }
- public function offsetUnset($x) { }
+ public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; }
+ public function offsetGet($x) { var_dump($x); return 42; }
+ public function offsetSet($x, $y) { }
+ public function offsetUnset($x) { }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.14.phpt b/Zend/tests/bug75420.14.phpt
index 07fb2cd984..7d2a349951 100644
--- a/Zend/tests/bug75420.14.phpt
+++ b/Zend/tests/bug75420.14.phpt
@@ -3,10 +3,10 @@ Bug #75420.14 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
- public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; }
- public function offsetGet($x) { var_dump($x); return 42; }
- public function offsetSet($x, $y) { }
- public function offsetUnset($x) { }
+ public function offsetExists($x) { $GLOBALS["obj"] = 24; return true; }
+ public function offsetGet($x) { var_dump($x); return 42; }
+ public function offsetSet($x, $y) { }
+ public function offsetUnset($x) { }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.15.phpt b/Zend/tests/bug75420.15.phpt
index f747b4c887..421cadf11a 100644
--- a/Zend/tests/bug75420.15.phpt
+++ b/Zend/tests/bug75420.15.phpt
@@ -3,10 +3,10 @@ Bug #75420.15 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
- public function offsetExists($x) { }
- public function offsetGet($x) { }
- public function offsetSet($x, $y) { $GLOBALS["name"] = 24; var_dump($x); }
- public function offsetUnset($x) { }
+ public function offsetExists($x) { }
+ public function offsetGet($x) { }
+ public function offsetSet($x, $y) { $GLOBALS["name"] = 24; var_dump($x); }
+ public function offsetUnset($x) { }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.16.phpt b/Zend/tests/bug75420.16.phpt
index 6c3982eacc..31a6957d89 100644
--- a/Zend/tests/bug75420.16.phpt
+++ b/Zend/tests/bug75420.16.phpt
@@ -3,10 +3,10 @@ Bug #75420.16 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
- public function offsetExists($x) { }
- public function offsetGet($x) { }
- public function offsetSet($x, $y) { $GLOBALS["obj"] = 24; var_dump($this); }
- public function offsetUnset($x) { }
+ public function offsetExists($x) { }
+ public function offsetGet($x) { }
+ public function offsetSet($x, $y) { $GLOBALS["obj"] = 24; var_dump($this); }
+ public function offsetUnset($x) { }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.2.phpt b/Zend/tests/bug75420.2.phpt
index 994327d195..b078175a6e 100644
--- a/Zend/tests/bug75420.2.phpt
+++ b/Zend/tests/bug75420.2.phpt
@@ -3,8 +3,8 @@ Bug #75420.2 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
- public function __isset($x) { $GLOBALS["name"] = 24; return true; }
- public function __get($x) { var_dump($x); return 42; }
+ public function __isset($x) { $GLOBALS["name"] = 24; return true; }
+ public function __get($x) { var_dump($x); return 42; }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.3.phpt b/Zend/tests/bug75420.3.phpt
index 4810618d15..46c81fc7c9 100644
--- a/Zend/tests/bug75420.3.phpt
+++ b/Zend/tests/bug75420.3.phpt
@@ -3,8 +3,8 @@ Bug #75420.3 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
- public function __isset($x) { $GLOBALS["name"] = 24; return true; }
- public function __get($x) { var_dump($x); return 42; }
+ public function __isset($x) { $GLOBALS["name"] = 24; return true; }
+ public function __get($x) { var_dump($x); return 42; }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.4.phpt b/Zend/tests/bug75420.4.phpt
index e25bf313cb..216b4d82e5 100644
--- a/Zend/tests/bug75420.4.phpt
+++ b/Zend/tests/bug75420.4.phpt
@@ -3,8 +3,8 @@ Bug #75420.4 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
- public function __isset($x) { $GLOBALS["name"] = 24; return true; }
- public function __get($x) { var_dump($x); return 42; }
+ public function __isset($x) { $GLOBALS["name"] = 24; return true; }
+ public function __get($x) { var_dump($x); return 42; }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.5.phpt b/Zend/tests/bug75420.5.phpt
index 85fedc4679..3bcd1110ad 100644
--- a/Zend/tests/bug75420.5.phpt
+++ b/Zend/tests/bug75420.5.phpt
@@ -3,8 +3,8 @@ Bug #75420.5 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
- public function __isset($x) { $GLOBALS["obj"] = 24; return true; }
- public function __get($x) { var_dump($this); return 42; }
+ public function __isset($x) { $GLOBALS["obj"] = 24; return true; }
+ public function __get($x) { var_dump($this); return 42; }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.6.phpt b/Zend/tests/bug75420.6.phpt
index e4aa230b48..0902292326 100644
--- a/Zend/tests/bug75420.6.phpt
+++ b/Zend/tests/bug75420.6.phpt
@@ -3,8 +3,8 @@ Bug #75420.6 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
- public function __isset($x) { $GLOBALS["obj"] = 24; return true; }
- public function __get($x) { var_dump($this); return 42; }
+ public function __isset($x) { $GLOBALS["obj"] = 24; return true; }
+ public function __get($x) { var_dump($this); return 42; }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.7.phpt b/Zend/tests/bug75420.7.phpt
index 0b9743a880..47b7a5f2f1 100644
--- a/Zend/tests/bug75420.7.phpt
+++ b/Zend/tests/bug75420.7.phpt
@@ -3,7 +3,7 @@ Bug #75420.7 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
- public function __set($x,$v) { $GLOBALS["name"] = 24; var_dump($x); }
+ public function __set($x,$v) { $GLOBALS["name"] = 24; var_dump($x); }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.8.phpt b/Zend/tests/bug75420.8.phpt
index 2d57c8b1cb..1d0f5ece3e 100644
--- a/Zend/tests/bug75420.8.phpt
+++ b/Zend/tests/bug75420.8.phpt
@@ -3,7 +3,7 @@ Bug #75420.8 (Indirect modification of magic method argument)
--FILE--
<?php
class Test {
- public function __set($x,$v) { $GLOBALS["obj"] = 24; var_dump($this); }
+ public function __set($x,$v) { $GLOBALS["obj"] = 24; var_dump($this); }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.9.phpt b/Zend/tests/bug75420.9.phpt
index d83878e773..0bb96edda4 100644
--- a/Zend/tests/bug75420.9.phpt
+++ b/Zend/tests/bug75420.9.phpt
@@ -3,10 +3,10 @@ Bug #75420.9 (Indirect modification of magic method argument)
--FILE--
<?php
class Test implements ArrayAccess {
- public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
- public function offsetGet($x) { var_dump($x); return 42; }
- public function offsetSet($x, $y) { }
- public function offsetUnset($x) { }
+ public function offsetExists($x) { $GLOBALS["name"] = 24; return true; }
+ public function offsetGet($x) { var_dump($x); return 42; }
+ public function offsetSet($x, $y) { }
+ public function offsetUnset($x) { }
}
$obj = new Test;
diff --git a/Zend/tests/bug75420.phpt b/Zend/tests/bug75420.phpt
index 05ef892879..4fda3d833f 100644
--- a/Zend/tests/bug75420.phpt
+++ b/Zend/tests/bug75420.phpt
@@ -4,7 +4,7 @@ Bug #75420 (Crash when modifying property name in __isset for BP_VAR_IS)
<?php
class Test {
- public function __isset($x) { $GLOBALS["name"] = 24; return true; }
+ public function __isset($x) { $GLOBALS["name"] = 24; return true; }
public function __get($x) { var_dump($x); return 42; }
}
diff --git a/Zend/tests/bug75573.phpt b/Zend/tests/bug75573.phpt
index f5e87f8283..09458f742e 100644
--- a/Zend/tests/bug75573.phpt
+++ b/Zend/tests/bug75573.phpt
@@ -5,37 +5,41 @@ Bug #75573 (Segmentation fault in 7.1.12 and 7.0.26)
class A
{
- var $_stdObject;
- function &__get($property)
- {
- if (isset($this->_stdObject->{$property})) {
- $retval =& $this->_stdObject->{$property};
- return $retval;
- } else {
- return NULL;
- }
- }
- function &__set($property, $value)
- {
- return $this->_stdObject->{$property} = $value;
- }
- function __isset($property_name)
- {
- return isset($this->_stdObject->{$property_name});
- }
+ var $_stdObject;
+ function __construct()
+ {
+ $this->_stdObject = new stdClass;
+ }
+ function &__get($property)
+ {
+ if (isset($this->_stdObject->{$property})) {
+ $retval =& $this->_stdObject->{$property};
+ return $retval;
+ } else {
+ return NULL;
+ }
+ }
+ function &__set($property, $value)
+ {
+ return $this->_stdObject->{$property} = $value;
+ }
+ function __isset($property_name)
+ {
+ return isset($this->_stdObject->{$property_name});
+ }
}
class B extends A
{
- function &__get($property)
- {
- if (isset($this->settings) && isset($this->settings[$property])) {
- $retval =& $this->settings[$property];
- return $retval;
- } else {
- return parent::__get($property);
- }
- }
+ function &__get($property)
+ {
+ if (isset($this->settings) && isset($this->settings[$property])) {
+ $retval =& $this->settings[$property];
+ return $retval;
+ } else {
+ return parent::__get($property);
+ }
+ }
}
$b = new B();
@@ -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..ab82c85840 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" on null
-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" on null
-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" on null
-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" on null
-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" on null
-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..ba89e8a3f9 100644
--- a/Zend/tests/bug76025.phpt
+++ b/Zend/tests/bug76025.phpt
@@ -4,8 +4,8 @@ Bug #76025 (Segfault while throwing exception in error_handler)
<?php
function handleError($errno, $errstr, $errfile, $errline) {
- $exception = new exception("blah");
- throw $exception;
+ $exception = new exception("blah");
+ throw $exception;
}
set_error_handler('handleError', E_ALL);
$c = $b[$a];
@@ -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..f544d964c4 100644
--- a/Zend/tests/bug76534.phpt
+++ b/Zend/tests/bug76534.phpt
@@ -3,15 +3,15 @@ Bug #76534 (PHP hangs on 'illegal string offset on string references with an err
--FILE--
<?php
set_error_handler(function ($severity, $message, $file, $line) {
- throw new \Exception($message);
+ throw new \Exception($message);
});
$x = "foo";
-$y = &$x["bar"];
+$y = &$x["2bar"];
?>
--EXPECTF--
-Fatal error: Uncaught Exception: Illegal string offset 'bar' in %sbug76534.php:%d
+Fatal error: Uncaught Exception: Illegal string offset "2bar" in %s:%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..03bd490a04 100644
--- a/Zend/tests/bug76667.phpt
+++ b/Zend/tests/bug76667.phpt
@@ -4,35 +4,26 @@ Bug #76667 (Segfault with divide-assign op and __get + __set)
<?php
class T {
- public function __get($k)
- {
- return $undefined->$k;
- }
+ public function __get($k)
+ {
+ return $undefined->$k;
+ }
- public function __set($k, $v)
- {
- return $this->$v /= 0;
- }
-};
+ public function __set($k, $v)
+ {
+ return $this->$v /= 0;
+ }
+}
$x = new T;
-$x->x = 1;
+try {
+ $x->x = 1;
+} catch (\DivisionByZeroError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
--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: Division by zero in %sbug76667.php on line %d
-
-Notice: Undefined variable: undefined in %sbug76667.php on line %d
-
-Notice: Trying to get property 'NAN' of non-object in %sbug76667.php on line %d
-
-Warning: Division by zero in %sbug76667.php on line %d
-
-Notice: Undefined variable: undefined in %sbug76667.php on line %d
-
-Notice: Trying to get property 'NAN' of non-object in %sbug76667.php on line %d
-
-Warning: Division by zero in %sbug76667.php on line %d
+Warning: Attempt to read property "1" on null in %s on line %d
+Division by zero
diff --git a/Zend/tests/bug76754.phpt b/Zend/tests/bug76754.phpt
index 424f1fbffc..d36d98b369 100644
--- a/Zend/tests/bug76754.phpt
+++ b/Zend/tests/bug76754.phpt
@@ -1,14 +1,11 @@
--TEST--
Bug #76754 (parent private constant in extends class memory leak)
---INI--
-opcache.enable=0
-opcache.enable_cli=0
--FILE--
<?php
class FOO
{
- private const FOO = 'BAR';
+ private const FOO = 'BAR';
}
class BAR extends FOO { }
diff --git a/Zend/tests/bug76800.phpt b/Zend/tests/bug76800.phpt
index d7f6d8070b..0caac2a357 100644
--- a/Zend/tests/bug76800.phpt
+++ b/Zend/tests/bug76800.phpt
@@ -8,6 +8,7 @@ foreach($arr as $key => &$val) { // without & will print both keys
$arr[0] = 0; // without this line will print both keys
unset($arr[0]);
}
+?>
--EXPECT--
See key 1
See key 3
diff --git a/Zend/tests/bug76846.phpt b/Zend/tests/bug76846.phpt
index fbef201033..cd837bd860 100644
--- a/Zend/tests/bug76846.phpt
+++ b/Zend/tests/bug76846.phpt
@@ -6,7 +6,7 @@ memory_limit=33M
<?php
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
if ($zend_mm_enabled === "0") {
- die("skip Zend MM disabled");
+ die("skip Zend MM disabled");
}
?>
--FILE--
diff --git a/Zend/tests/bug76860.phpt b/Zend/tests/bug76860.phpt
index 046edba7f2..defe6153ba 100644
--- a/Zend/tests/bug76860.phpt
+++ b/Zend/tests/bug76860.phpt
@@ -7,7 +7,7 @@ class A {
protected static $b = "b";
public static $c = "c";
public function __construct() {
- var_dump($this->a, $this->b, $this->c);
+ var_dump($this->a, $this->b, $this->c);
}
}
class B extends A {
@@ -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..2a64a97c2f 100644
--- a/Zend/tests/bug76860_2.phpt
+++ b/Zend/tests/bug76860_2.phpt
@@ -7,7 +7,7 @@ class A {
private static $b = "b";
private static $c = "c";
public function __construct() {
- var_dump($this->a, $this->b, $this->c);
+ var_dump($this->a, $this->b, $this->c);
}
}
class B extends A {
@@ -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/bug76869.phpt b/Zend/tests/bug76869.phpt
index ba963d4c4e..a19d2dfedb 100644
--- a/Zend/tests/bug76869.phpt
+++ b/Zend/tests/bug76869.phpt
@@ -1,23 +1,23 @@
--TEST--
-Bug #76869 (Incorrect bypassing protected method accessibilty check)
+Bug #76869 (Incorrect bypassing protected method accessibility check)
--FILE--
<?php
class A {
- private function f() {
- return "A";
- }
+ private function f() {
+ return "A";
+ }
}
class B extends A {
- protected function f() {
- return "B";
- }
+ protected function f() {
+ return "B";
+ }
}
$b = new B();
try {
- var_dump($b->f());
+ var_dump($b->f());
} catch (Throwable $e) {
- echo "Exception: ", $e->getMessage(), "\n";
+ echo "Exception: ", $e->getMessage(), "\n";
}
?>
--EXPECT--
-Exception: Call to protected method B::f() from context ''
+Exception: Call to protected method B::f() from global scope
diff --git a/Zend/tests/bug76965.phpt b/Zend/tests/bug76965.phpt
index 1a8e7d2d35..64165e81f6 100644
--- a/Zend/tests/bug76965.phpt
+++ b/Zend/tests/bug76965.phpt
@@ -4,10 +4,10 @@ Bug #76965 (INI_SCANNER_RAW doesn't strip trailing whitespace)
<?php
// the trailing whitespace is intentional
$ini = <<<END
-1="foo"
-2="bar" ; comment
-3= baz
-4= "foo;bar"
+1="foo"
+2="bar" ; comment
+3= baz
+4= "foo;bar"
5= "foo" ; bar ; baz
6= "foo;bar" ; baz
7= foo"bar ; "ok
@@ -15,7 +15,6 @@ END;
var_dump(parse_ini_string($ini, false, INI_SCANNER_RAW));
?>
-===DONE===
--EXPECT--
array(7) {
[1]=>
@@ -33,4 +32,3 @@ array(7) {
[7]=>
string(7) "foo"bar"
}
-===DONE===
diff --git a/Zend/tests/bug77291.phpt b/Zend/tests/bug77291.phpt
index 2960648a7c..e5977eba08 100644
--- a/Zend/tests/bug77291.phpt
+++ b/Zend/tests/bug77291.phpt
@@ -35,8 +35,6 @@ var_dump(isset($foo->a));
$foo = new Foo45;
var_dump($foo->a);
?>
-===DONE===
--EXPECT--
bool(true)
string(10) "Some value"
-===DONE===
diff --git a/Zend/tests/bug77339.phpt b/Zend/tests/bug77339.phpt
index 2e749bcd5a..c21b8cbad2 100644
--- a/Zend/tests/bug77339.phpt
+++ b/Zend/tests/bug77339.phpt
@@ -11,7 +11,7 @@ class Foo
var_dump($arguments);
exit;
}
- }
+ }
echo "OK\n";
}
diff --git a/Zend/tests/bug77345_gc_1.phpt b/Zend/tests/bug77345_gc_1.phpt
index eabb94ce7d..b50031aba6 100644
--- a/Zend/tests/bug77345_gc_1.phpt
+++ b/Zend/tests/bug77345_gc_1.phpt
@@ -36,7 +36,8 @@ for ($i = 0; $i < 200000; $i++) {
$circularDoublyLinkedList = $nextNode;
}
var_dump('end');
+?>
--EXPECT--
bool(true)
string(5) "start"
-string(3) "end" \ No newline at end of file
+string(3) "end"
diff --git a/Zend/tests/bug77345_gc_2.phpt b/Zend/tests/bug77345_gc_2.phpt
index 9d39b6b969..57353c5a3f 100644
--- a/Zend/tests/bug77345_gc_2.phpt
+++ b/Zend/tests/bug77345_gc_2.phpt
@@ -42,7 +42,8 @@ xxx();
gc_collect_cycles();
var_dump('end');
+?>
--EXPECT--
bool(true)
string(5) "start"
-string(3) "end" \ No newline at end of file
+string(3) "end"
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/bug77589.phpt b/Zend/tests/bug77589.phpt
index ad07ee1351..d9b5301b2b 100644
--- a/Zend/tests/bug77589.phpt
+++ b/Zend/tests/bug77589.phpt
@@ -3,14 +3,14 @@ BUG #77589 (Core dump using parse_ini_string with numeric sections)
--FILE--
<?php
var_dump(
- parse_ini_string(<<<INI
+ parse_ini_string(<<<INI
[0]
a = 1
b = on
c = true
["true"]
-a = 100
+a = 100
b = null
c = yes
INI
diff --git a/Zend/tests/bug77738.phpt b/Zend/tests/bug77738.phpt
index e3a453c405..e940b85ba5 100644
--- a/Zend/tests/bug77738.phpt
+++ b/Zend/tests/bug77738.phpt
@@ -4,5 +4,9 @@ Bug #77738 (Nullptr deref in zend_compile_expr)
<?php
__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/bug77877.phpt b/Zend/tests/bug77877.phpt
index d4627f77c8..6ed35213ef 100644
--- a/Zend/tests/bug77877.phpt
+++ b/Zend/tests/bug77877.phpt
@@ -3,19 +3,19 @@ Bug #77877 call_user_func() passes $this to static methods
--FILE--
<?php
class Foo {
- static public function bar() {
- var_dump($this);
- }
+ static public function bar() {
+ var_dump($this);
+ }
}
try {
- array_map([new Foo, 'bar'],[1]);
+ array_map([new Foo, 'bar'],[1]);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- call_user_func([new Foo, 'bar']);
+ call_user_func([new Foo, 'bar']);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/bug77966.phpt b/Zend/tests/bug77966.phpt
new file mode 100644
index 0000000000..1e859be8e1
--- /dev/null
+++ b/Zend/tests/bug77966.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #77966: Cannot alias a method named "namespace"
+--FILE--
+<?php
+
+trait A {
+ function namespace() {
+ echo "Called\n";
+ }
+}
+
+class C {
+ use A {
+ namespace as bar;
+ }
+}
+
+$c = new C;
+$c->bar();
+$c->namespace();
+
+?>
+--EXPECT--
+Called
+Called
diff --git a/Zend/tests/bug77993.phpt b/Zend/tests/bug77993.phpt
index c19841811b..e7b2bec776 100644
--- a/Zend/tests/bug77993.phpt
+++ b/Zend/tests/bug77993.phpt
@@ -3,5 +3,6 @@ Bug #77993 (Wrong parse error for invalid hex literal on Windows)
--FILE--
<?php
0xg10;
+?>
--EXPECTF--
-Parse error: syntax error, unexpected 'xg10' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "xg10" in %s on line %d
diff --git a/Zend/tests/bug78154.phpt b/Zend/tests/bug78154.phpt
index 2a69ebe811..6a20af38f5 100644
--- a/Zend/tests/bug78154.phpt
+++ b/Zend/tests/bug78154.phpt
@@ -4,20 +4,23 @@ Bug #78154: SEND_VAR_NO_REF does not always send reference
<?php
namespace {
- var_dump(similar_text('a', 'a', $c=0x44444444));
- var_dump($c);
+ try {
+ var_dump(similar_text('a', 'a', $c=0x44444444));
+ var_dump($c);
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
}
namespace Foo {
- var_dump(similar_text('a', 'a', $d=0x44444444));
- var_dump($d);
+ try {
+ var_dump(similar_text('a', 'a', $d=0x44444444));
+ var_dump($d);
+ } catch (\Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
}
?>
---EXPECTF--
-Notice: Only variables should be passed by reference in %s on line %d
-int(1)
-int(1145324612)
-
-Notice: Only variables should be passed by reference in %s on line %d
-int(1)
-int(1145324612)
+--EXPECT--
+Exception: similar_text(): Argument #3 ($percent) cannot be passed by reference
+Exception: similar_text(): Argument #3 ($percent) cannot be passed by reference
diff --git a/Zend/tests/bug78182.phpt b/Zend/tests/bug78182.phpt
index 4b0f08dc3b..a751e953bb 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" on null
+NULL
diff --git a/Zend/tests/bug78239.phpt b/Zend/tests/bug78239.phpt
index 94908a785b..1ecad67460 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: Method _ZendTestClass::__toString() is deprecated in %s:%d
Stack trace:
#0 %s(%d): handleError(%s)
#1 {main}
diff --git a/Zend/tests/bug78344.phpt b/Zend/tests/bug78344.phpt
index c1ff5e0b40..ea628aaf01 100644
--- a/Zend/tests/bug78344.phpt
+++ b/Zend/tests/bug78344.phpt
@@ -17,7 +17,7 @@ class C extends B {
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot access protected const A::FOO in %s:%d
+Fatal error: Uncaught Error: Cannot access protected constant A::FOO in %s:%d
Stack trace:
#0 %s(%d): C->method()
#1 {main}
diff --git a/Zend/tests/bug78379.phpt b/Zend/tests/bug78379.phpt
index e48e9b7ca4..0f8d216bd3 100644
--- a/Zend/tests/bug78379.phpt
+++ b/Zend/tests/bug78379.phpt
@@ -1,13 +1,11 @@
--TEST--
Bug #78379 (Cast to object confuses GC, causes crash)
---INI--
-opcache.enable=0
--FILE--
<?php
class C {
- public function __construct() {
- $this->p = (object)["x" => [1]];
- }
+ public function __construct() {
+ $this->p = (object)["x" => [1]];
+ }
}
class E {
}
diff --git a/Zend/tests/bug78379_2.phpt b/Zend/tests/bug78379_2.phpt
index 0a515a2b07..b1e7e3527f 100644
--- a/Zend/tests/bug78379_2.phpt
+++ b/Zend/tests/bug78379_2.phpt
@@ -4,12 +4,12 @@ Bug #78379.2 (Cast to object confuses GC, causes crash)
<?php
class E {}
function f() {
- $e1 = new E;
- $e2 = new E;
- $a = ['e2' => $e2];
- $e1->a = (object)$a;
- $e2->e1 = $e1;
- $e2->a = (object)$a;
+ $e1 = new E;
+ $e2 = new E;
+ $a = ['e2' => $e2];
+ $e1->a = (object)$a;
+ $e2->e1 = $e1;
+ $e2->a = (object)$a;
}
f();
gc_collect_cycles();
diff --git a/Zend/tests/bug78396.phpt b/Zend/tests/bug78396.phpt
index 1f08a47dc4..f5d8281941 100644
--- a/Zend/tests/bug78396.phpt
+++ b/Zend/tests/bug78396.phpt
@@ -2,7 +2,7 @@
Bug #78396: Second file_put_contents in Shutdown hangs script
--FILE--
<?php
-
+
register_shutdown_function(function () {
file_put_contents(__DIR__ . '/bug78396.txt', '1', FILE_APPEND | LOCK_EX);
file_put_contents(__DIR__ . '/bug78396.txt', '2', FILE_APPEND | LOCK_EX);
diff --git a/Zend/tests/bug78454_1.phpt b/Zend/tests/bug78454_1.phpt
index 184d358372..fb4d329578 100644
--- a/Zend/tests/bug78454_1.phpt
+++ b/Zend/tests/bug78454_1.phpt
@@ -4,4 +4,4 @@ Invalid consecutive numeric separators after hex literal
<?php
0x0__F;
--EXPECTF--
-Parse error: syntax error, unexpected '__F' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "__F" in %s on line %d
diff --git a/Zend/tests/bug78454_2.phpt b/Zend/tests/bug78454_2.phpt
index b67b8396ac..f57eda491d 100644
--- a/Zend/tests/bug78454_2.phpt
+++ b/Zend/tests/bug78454_2.phpt
@@ -4,4 +4,4 @@ Invalid consecutive numeric separators after binary literal
<?php
0b0__1
--EXPECTF--
-Parse error: syntax error, unexpected '__1' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "__1" in %s on line %d
diff --git a/Zend/tests/bug78531.phpt b/Zend/tests/bug78531.phpt
index ba460ee05a..b818afb79a 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" on null
+
+Warning: Undefined variable $u2 in %s on line %d
+Attempt to increment/decrement property "a" on null
+
+Warning: Undefined variable $u3 in %s on line %d
+Attempt to increment/decrement property "a" on null
+
+Warning: Undefined variable $u4 in %s on line %d
+Attempt to modify property "a" on null
diff --git a/Zend/tests/bug78658.phpt b/Zend/tests/bug78658.phpt
index 3445b98b09..30ebe9de80 100644
--- a/Zend/tests/bug78658.phpt
+++ b/Zend/tests/bug78658.phpt
@@ -11,4 +11,4 @@ $c->bindTo(new stdClass, $scope);
?>
--EXPECTF--
-Warning: Class 'AAAABBBB' not found in %s on line %d
+Warning: Class "AAAABBBB" not found in %s on line %d
diff --git a/Zend/tests/bug78770.phpt b/Zend/tests/bug78770.phpt
new file mode 100644
index 0000000000..b1cf783b95
--- /dev/null
+++ b/Zend/tests/bug78770.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #78770: Incorrect callability check inside internal methods
+--SKIPIF--
+<?php
+if (!extension_loaded("intl")) die("skip requires intl");
+?>
+--FILE--
+<?php
+
+class Test {
+ public function method() {
+ IntlChar::enumCharTypes([$this, 'privateMethod']);
+ IntlChar::enumCharTypes('self::privateMethod');
+ }
+
+ private function privateMethod($start, $end, $name) {
+ }
+}
+
+(new Test)->method();
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/bug78868.phpt b/Zend/tests/bug78868.phpt
index 172af2a930..7502662c9e 100644
--- a/Zend/tests/bug78868.phpt
+++ b/Zend/tests/bug78868.phpt
@@ -3,25 +3,25 @@ Bug #78868: Calling __autoload() with incorrect EG(fake_scope) value
--FILE--
<?php
class C {
- private $private = 1;
+ private $private = 1;
- function foo() {
- $this->private++; //fails with EG(fake_scope) != NULL && EG(fake_scope) != "C"
- }
+ function foo() {
+ $this->private++; //fails with EG(fake_scope) != NULL && EG(fake_scope) != "C"
+ }
}
class A {
- static $foo = B::foo; //not resolved on include()
+ static $foo = B::foo; //not resolved on include()
}
function main_autoload($class_name) {
- $c = new C;
- $c->foo();
- //doesn't affect the error
- eval("class B {const foo = 1;}");
+ $c = new C;
+ $c->foo();
+ //doesn't affect the error
+ eval("class B {const foo = 1;}");
}
-spl_autoload_register('main_autoload', false);
+spl_autoload_register('main_autoload');
$classA = new ReflectionClass("A");
$props = $classA->getProperties();
diff --git a/Zend/tests/bug78898.phpt b/Zend/tests/bug78898.phpt
index 9efd1416e2..248195e551 100644
--- a/Zend/tests/bug78898.phpt
+++ b/Zend/tests/bug78898.phpt
@@ -5,25 +5,25 @@ Bug #78898: call_user_func(['parent', ...]) fails while other succeed
class A
{
- protected function _x()
- {
- echo "a";
- }
+ protected function _x()
+ {
+ echo "a";
+ }
- public function __call($methodName, array $arguments)
- {
- throw new Exception("Unknown method.");
- }
+ public function __call($methodName, array $arguments)
+ {
+ throw new Exception("Unknown method.");
+ }
}
class B extends A
{
- public function x()
- {
- parent::_x();
- call_user_func('parent::_x');
- call_user_func(['parent', '_x']);
- }
+ public function x()
+ {
+ parent::_x();
+ call_user_func('parent::_x');
+ call_user_func(['parent', '_x']);
+ }
}
$b = new B;
diff --git a/Zend/tests/bug78926.phpt b/Zend/tests/bug78926.phpt
index 5df92bdb5a..a59692748b 100644
--- a/Zend/tests/bug78926.phpt
+++ b/Zend/tests/bug78926.phpt
@@ -18,5 +18,5 @@ var_dump(class_exists('B', false));
?>
--EXPECT--
-Class 'A' not found
+Class "A" not found
bool(false)
diff --git a/Zend/tests/bug78999.phpt b/Zend/tests/bug78999.phpt
index d4ec16b972..bf7291a322 100644
--- a/Zend/tests/bug78999.phpt
+++ b/Zend/tests/bug78999.phpt
@@ -3,12 +3,13 @@ Bug #78999 (Cycle leak when using function result as temporary)
--FILE--
<?php
function get() {
- $t = new stdClass;
- $t->prop = $t;
- return $t;
+ $t = new stdClass;
+ $t->prop = $t;
+ return $t;
}
var_dump(get());
var_dump(gc_collect_cycles());
+?>
--EXPECT--
object(stdClass)#1 (1) {
["prop"]=>
diff --git a/Zend/tests/bug79022.phpt b/Zend/tests/bug79022.phpt
index 0657b20355..904195518e 100644
--- a/Zend/tests/bug79022.phpt
+++ b/Zend/tests/bug79022.phpt
@@ -4,31 +4,31 @@ Bug #79022 (class_exists returns True for classes that are not ready to be used)
<?php
function my_autoloader($class) {
if (class_exists('Foo', 0)) {
- new Foo();
+ new Foo();
+ }
+ if ($class == 'Foo') {
+ eval("class Foo extends Bar{}");
}
- if ($class == 'Foo') {
- eval("class Foo extends Bar{}");
- }
- if ($class == 'Bar') {
- eval("class Bar {}");
+ if ($class == 'Bar') {
+ eval("class Bar {}");
}
- if ($class == 'Dummy') {
- eval ("class Dummy implements iFoo {}");
- }
+ if ($class == 'Dummy') {
+ eval ("class Dummy implements iFoo {}");
+ }
- if (interface_exists('iFoo', 0)) {
- new Dummy();
- }
- if ($class == 'iFoo') {
- eval ("interface iFoo extends iBar {}");
- }
+ if (interface_exists('iFoo', 0)) {
+ new Dummy();
+ }
+ if ($class == 'iFoo') {
+ eval ("interface iFoo extends iBar {}");
+ }
- if ($class == 'iBar') {
- eval ("interface iBar {}");
- }
+ if ($class == 'iBar') {
+ eval ("interface iBar {}");
+ }
}
spl_autoload_register('my_autoloader');
new Foo();
diff --git a/Zend/tests/bug79108.phpt b/Zend/tests/bug79108.phpt
new file mode 100644
index 0000000000..9d1b7c963b
--- /dev/null
+++ b/Zend/tests/bug79108.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #79108: Referencing argument in a function makes it a reference in the stack trace
+--FILE--
+<?php
+
+function test(string $val) {
+ $a = &$val;
+ hackingHere();
+ print_r($val);
+}
+
+function hackingHere() {
+ // we're able to modify the $val from here, even though the arg was not a reference
+ debug_backtrace()[1]['args'][0] = 'Modified';
+}
+
+test('Original');
+
+?>
+--EXPECT--
+Original
diff --git a/Zend/tests/bug79155.phpt b/Zend/tests/bug79155.phpt
index be9488da86..d3b31436bd 100644
--- a/Zend/tests/bug79155.phpt
+++ b/Zend/tests/bug79155.phpt
@@ -4,8 +4,8 @@ Bug #79155: Property nullability lost when using multiple property definition
<?php
class Foo {
- public ?string $a, $b;
- public ?stdClass $c, $d;
+ public ?string $a, $b;
+ public ?stdClass $c, $d;
}
$t = new Foo;
diff --git a/Zend/tests/bug79382.phpt b/Zend/tests/bug79382.phpt
new file mode 100644
index 0000000000..5c1abe2d5f
--- /dev/null
+++ b/Zend/tests/bug79382.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #79382: Cannot redeclare disabled function
+--INI--
+disable_functions=strlen
+--FILE--
+<?php
+
+function strlen(string $x): int {
+ return 42;
+}
+
+var_dump(strlen("foobar"));
+
+?>
+--EXPECT--
+int(42)
diff --git a/Zend/tests/bug79477.phpt b/Zend/tests/bug79477.phpt
index cb5340d104..b717a830df 100644
--- a/Zend/tests/bug79477.phpt
+++ b/Zend/tests/bug79477.phpt
@@ -4,7 +4,7 @@ Bug #79477: casting object into array creates references
<?php
class Test {
- public $prop = 'default value';
+ public $prop = 'default value';
}
$obj = new Test;
diff --git a/Zend/tests/bug79599.phpt b/Zend/tests/bug79599.phpt
index d3ae8edacc..57e5332431 100644
--- a/Zend/tests/bug79599.phpt
+++ b/Zend/tests/bug79599.phpt
@@ -3,25 +3,25 @@ Bug #79599 (coredump in set_error_handler)
--FILE--
<?php
set_error_handler(function($code, $message){
- throw new \Exception($message);
+ throw new \Exception($message);
});
function test1(){
- $a[] = $b;
+ $a[] = $b;
}
function test2(){
- $a[$c] = $b;
+ $a[$c] = $b;
}
try{
- test1();
+ test1();
}catch(\Exception $e){
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try{
- test2();
+ test2();
}catch(\Exception $e){
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
--EXPECT--
-string(21) "Undefined variable: b"
-string(21) "Undefined variable: b"
+string(21) "Undefined variable $b"
+string(21) "Undefined variable $c"
diff --git a/Zend/tests/bug79740.phpt b/Zend/tests/bug79740.phpt
deleted file mode 100644
index 311bcbcf56..0000000000
--- a/Zend/tests/bug79740.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Bug #79740: serialize() and unserialize() methods can not be called statically
---FILE--
-<?php
-class A {
- public function serialize() { }
- public function unserialize() { }
-}
-
-var_dump(is_callable(['A', 'serialize']));
-var_dump(is_callable(['A', 'unserialize']));
-A::serialize();
-A::unserialize();
-
-?>
---EXPECTF--
-bool(true)
-bool(true)
-
-Deprecated: Non-static method A::serialize() should not be called statically in %s on line %d
-
-Deprecated: Non-static method A::unserialize() should not be called statically in %s on line %d
diff --git a/Zend/tests/bug79783.phpt b/Zend/tests/bug79783.phpt
index 959e90b06d..6accb0c284 100644
--- a/Zend/tests/bug79783.phpt
+++ b/Zend/tests/bug79783.phpt
@@ -5,7 +5,7 @@ Bug #79783: Segfault in php_str_replace_common
str_replace("a", "b", "c", strlen("d"));
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot pass parameter 4 by reference in %s:%d
+Fatal error: Uncaught Error: str_replace(): Argument #4 ($count) cannot be passed by reference in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug79790.phpt b/Zend/tests/bug79790.phpt
new file mode 100644
index 0000000000..4fce25291b
--- /dev/null
+++ b/Zend/tests/bug79790.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #79790: "Illegal offset type" exception during AST evaluation not handled properly
+--FILE--
+<?php
+b();
+function b($a = array()[array ()]) {
+ ++$c[function () {}];
+}
+?>
+--EXPECTF--
+Fatal error: Uncaught TypeError: Illegal offset type in %s:%d
+Stack trace:
+#0 %s(%d): b()
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug79791.phpt b/Zend/tests/bug79791.phpt
new file mode 100644
index 0000000000..f8b80a51d9
--- /dev/null
+++ b/Zend/tests/bug79791.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #79791: Assertion failure when unsetting variable during binary op
+--FILE--
+<?php
+set_error_handler(function() {
+ unset($GLOBALS['c']);
+});
+$c -= 1;
+var_dump($c);
+?>
+--EXPECT--
+int(-1)
diff --git a/Zend/tests/bug79792.phpt b/Zend/tests/bug79792.phpt
index 85b98a907b..ca662e27e9 100644
--- a/Zend/tests/bug79792.phpt
+++ b/Zend/tests/bug79792.phpt
@@ -12,5 +12,5 @@ foreach ($a as &$c) {
?>
===DONE===
--EXPECTF--
-Warning: Invalid argument supplied for foreach() in %s on line %d
+Warning: foreach() argument must be of type array|object, null given in %s on line %d
===DONE===
diff --git a/Zend/tests/bug79793.phpt b/Zend/tests/bug79793.phpt
index 9e4e2e20be..5491a2669e 100644
--- a/Zend/tests/bug79793.phpt
+++ b/Zend/tests/bug79793.phpt
@@ -18,12 +18,12 @@ var_dump($ary);
?>
--EXPECT--
-Undefined index: foobar
+Undefined array key "foobar"
array(1) {
["foobar"]=>
int(1)
}
-Undefined index: foobarbaz
+Undefined array key "foobarbaz"
array(2) {
["foobar"]=>
int(1)
diff --git a/Zend/tests/bug79818.phpt b/Zend/tests/bug79818.phpt
new file mode 100644
index 0000000000..721e677b2e
--- /dev/null
+++ b/Zend/tests/bug79818.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #79818: BIND_STATIC frees old variable value too early
+--FILE--
+<?php
+function test($a) {
+ static $a = UNDEFINED;
+}
+test(new stdClass);
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Undefined constant "UNDEFINED" in %s:%d
+Stack trace:
+#0 %s(%d): test(Object(stdClass))
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug79828.phpt b/Zend/tests/bug79828.phpt
new file mode 100644
index 0000000000..2bcb18e3e9
--- /dev/null
+++ b/Zend/tests/bug79828.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #79828: Segfault when trying to access non-existing variable
+--FILE--
+<?php
+function foo(): AnyType {
+ return $uninitialized;
+}
+foo();
+?>
+--EXPECTF--
+Warning: Undefined variable $uninitialized in %s on line %d
+
+Fatal error: Uncaught TypeError: foo(): Return value must be of type AnyType, null returned in %s:%d
+Stack trace:
+#0 %s(%d): foo()
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug79897.phpt b/Zend/tests/bug79897.phpt
new file mode 100644
index 0000000000..201a89f739
--- /dev/null
+++ b/Zend/tests/bug79897.phpt
@@ -0,0 +1,38 @@
+--TEST--
+bug79897: Promoted constructor params with attribs cause crash
+--FILE--
+<?php
+
+#[Attribute]
+class B {
+ public function __construct($value)
+ {
+ }
+}
+
+class A {
+ public function __construct(
+ #[B(12, X)] public $b
+ )
+ {
+ }
+}
+
+const X = 42;
+
+var_dump((new ReflectionParameter(['A', '__construct'], 'b'))->getAttributes()[0]->getArguments());
+var_dump((new ReflectionProperty('A', 'b'))->getAttributes()[0]->getArguments());
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ int(12)
+ [1]=>
+ int(42)
+}
+array(2) {
+ [0]=>
+ int(12)
+ [1]=>
+ int(42)
+}
diff --git a/Zend/tests/bug79900.phpt b/Zend/tests/bug79900.phpt
new file mode 100644
index 0000000000..a09a72c74c
--- /dev/null
+++ b/Zend/tests/bug79900.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #79900: Memory leaks reported if GC disabled at runtime
+--FILE--
+<?php
+
+gc_disable();
+$obj = new stdClass;
+$obj->obj = $obj;
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/bug79927.phpt b/Zend/tests/bug79927.phpt
new file mode 100644
index 0000000000..df8f245ddf
--- /dev/null
+++ b/Zend/tests/bug79927.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #79927: Generator doesn't throw exception after multiple yield from iterable
+--FILE--
+<?php
+
+$generator = (function () {
+ yield from [1, 2, 3];
+})();
+
+$generator->next();
+$generator->next();
+try {
+ $generator->rewind();
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+echo $generator->current(), "\n";
+
+$generator2 = (function () {
+ yield from [];
+ yield 4;
+})();
+$generator2->current();
+$generator2->rewind();
+echo $generator2->current(), "\n";
+
+?>
+--EXPECT--
+Cannot rewind a generator that was already run
+3
+4
diff --git a/Zend/tests/bug79947.phpt b/Zend/tests/bug79947.phpt
index 18d2d75a9d..906f58144b 100644
--- a/Zend/tests/bug79947.phpt
+++ b/Zend/tests/bug79947.phpt
@@ -4,10 +4,14 @@ Bug #79947: Memory leak on invalid offset type in compound assignment
<?php
$array = [];
$key = [];
-$array[$key] += [$key];
+try {
+ $array[$key] += [$key];
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($array);
?>
---EXPECTF--
-Warning: Illegal offset type in %s on line %d
+--EXPECT--
+Illegal offset type
array(0) {
}
diff --git a/Zend/tests/bug79948.inc b/Zend/tests/bug79948.inc
new file mode 100644
index 0000000000..b112b43c84
--- /dev/null
+++ b/Zend/tests/bug79948.inc
@@ -0,0 +1,2 @@
+<?php
+exit("Exiting...\n");
diff --git a/Zend/tests/bug79948.phpt b/Zend/tests/bug79948.phpt
new file mode 100644
index 0000000000..777a9269dd
--- /dev/null
+++ b/Zend/tests/bug79948.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #79948: Exit in auto-prepended file does not abort PHP execution
+--INI--
+auto_prepend_file={PWD}/bug79948.inc
+--FILE--
+<?php
+echo "Should not be executed.\n";
+?>
+--EXPECT--
+Exiting...
diff --git a/Zend/tests/bug79979.phpt b/Zend/tests/bug79979.phpt
index 8d7f30b7c8..753b2abdb5 100644
--- a/Zend/tests/bug79979.phpt
+++ b/Zend/tests/bug79979.phpt
@@ -2,16 +2,21 @@
Bug #79979 (passing value to by-ref param via CUF(A) crashes)
--FILE--
<?php
-call_user_func_array("str_replace", ["a", "b", "c", 0]);
-$cufa = "call_user_func_array";
-$cufa("str_replace", ["a", "b", "c", 0]);
+namespace Foo;
+
+call_user_func_array("str_replace", ["a", "b", "c", new \stdClass]);
+call_user_func_array("str_replace", ["a", "b", "c", "count" => new \stdClass]);
+
+\call_user_func_array("str_replace", ["a", "b", "c", new \stdClass]);
+\call_user_func_array("str_replace", ["a", "b", "c", "count" => new \stdClass]);
-call_user_func_array($cufa, ["str_replace", ["a", "b", "c", 0]]);
?>
--EXPECTF--
-Warning: Parameter 4 to str_replace() expected to be a reference, value given in %s on line %d
+Warning: str_replace(): Argument #4 ($count) must be passed by reference, value given in %s on line %d
+
+Warning: str_replace(): Argument #4 ($count) must be passed by reference, value given in %s on line %d
-Warning: Parameter 4 to str_replace() expected to be a reference, value given in %s on line %d
+Warning: str_replace(): Argument #4 ($count) must be passed by reference, value given in %s on line %d
-Warning: Parameter 4 to str_replace() expected to be a reference, value given in %s on line %d
+Warning: str_replace(): Argument #4 ($count) must be passed by reference, value given in %s on line %d
diff --git a/Zend/tests/bug80030.phpt b/Zend/tests/bug80030.phpt
new file mode 100644
index 0000000000..cf5a668345
--- /dev/null
+++ b/Zend/tests/bug80030.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #80030: Optimizer segfault with isset on static property with undef dynamic class name
+--FILE--
+<?php
+
+function test() {
+ var_dump(isset($className::$test));
+}
+test();
+
+?>
+--EXPECTF--
+Warning: Undefined variable $className in %s on line %d
+
+Fatal error: Uncaught Error: Class name must be a valid object or a string in %s:%d
+Stack trace:
+#0 %s(%d): test()
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug80037.phpt b/Zend/tests/bug80037.phpt
index 7bbe6128b3..d6e057546b 100644
--- a/Zend/tests/bug80037.phpt
+++ b/Zend/tests/bug80037.phpt
@@ -5,21 +5,21 @@ Bug #80037: Typed property must not be accessed before initialization when __get
final class A
{
- public string $a;
+ public string $a;
- public static function fromArray(array $props): self
- {
- $me = new static;
- foreach ($props as $k => &$v) {
- $me->{$k} = &$v; # try to remove &
- }
- return $me;
- }
+ public static function fromArray(array $props): self
+ {
+ $me = new static;
+ foreach ($props as $k => &$v) {
+ $me->{$k} = &$v; # try to remove &
+ }
+ return $me;
+ }
- public function __get($name)
- {
- throw new \LogicException("Property '$name' is not defined.");
- }
+ public function __get($name)
+ {
+ throw new \LogicException("Property '$name' is not defined.");
+ }
}
var_dump(A::fromArray(['a' => 'foo']));
diff --git a/Zend/tests/bug80045.phpt b/Zend/tests/bug80045.phpt
new file mode 100644
index 0000000000..b53b8b0c2a
--- /dev/null
+++ b/Zend/tests/bug80045.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #80045: memleak after two set_exception_handler calls with __call
+--FILE--
+<?php
+
+class x {
+ public function __construct(){
+ set_exception_handler([$this, 'dummyExceptionHandler']);
+ set_exception_handler([$this, 'dummyExceptionHandler']);
+ set_error_handler([$this, 'dummyErrorHandler']);
+ set_error_handler([$this, 'dummyErrorHandler']);
+ }
+
+ public function __call($m, $p) {}
+}
+
+new x;
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/bug80055.phpt b/Zend/tests/bug80055.phpt
new file mode 100644
index 0000000000..f43ab490a3
--- /dev/null
+++ b/Zend/tests/bug80055.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #80055: Abstract trait methods returning "self" cannot be fulfilled by traits
+--FILE--
+<?php
+
+trait AbstractTrait {
+ abstract public function selfReturner(): self;
+}
+
+trait ConcreteTrait {
+ public function selfReturner(): self {
+ return $this;
+ }
+}
+
+class Test {
+ use AbstractTrait;
+ use ConcreteTrait;
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/bug80096.phpt b/Zend/tests/bug80096.phpt
new file mode 100644
index 0000000000..d1d2d0249b
--- /dev/null
+++ b/Zend/tests/bug80096.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #80096: Segmentation fault with named arguments in nested call
+--FILE--
+<?php
+
+function println($arg) {
+ echo $arg, "\n";
+}
+
+println(htmlentities("The < character is encoded as &lt;", double_encode: false));
+
+?>
+--EXPECT--
+The &lt; character is encoded as &lt;
diff --git a/Zend/tests/bug80184.phpt b/Zend/tests/bug80184.phpt
new file mode 100644
index 0000000000..1d12799f0c
--- /dev/null
+++ b/Zend/tests/bug80184.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #80184: Complex expression in while / if statements resolves to false incorrectly
+--FILE--
+<?php
+
+$callbacks = [
+ function () { echo "First item!\n"; },
+ function () { echo "Second item!\n"; },
+ function () { echo "Third item!\n"; },
+ function () { echo "Fourth item!\n"; },
+];
+
+while ($callback = array_shift($callbacks) and ($callback() || true));
+
+?>
+--EXPECT--
+First item!
+Second item!
+Third item!
+Fourth item!
diff --git a/Zend/tests/bug80255.phpt b/Zend/tests/bug80255.phpt
new file mode 100644
index 0000000000..d3fc6b7abe
--- /dev/null
+++ b/Zend/tests/bug80255.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #80255: Opcache bug (bad condition result) in 8.0.0rc1
+--FILE--
+<?php
+
+function test($a, $b, $c) {
+ do {
+ if ($a && !$b) {
+ break;
+ } else if ($b) {
+ echo "foo\n";
+ }
+ echo "bar\n";
+ } while ($c);
+ echo "baz\n";
+}
+
+test(true, true, false);
+
+?>
+--EXPECT--
+foo
+bar
+baz
diff --git a/Zend/tests/bug80391.phpt b/Zend/tests/bug80391.phpt
new file mode 100644
index 0000000000..f483ed80fc
--- /dev/null
+++ b/Zend/tests/bug80391.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Iterable not covariant to mixed
+--FILE--
+<?php
+
+class A {
+ public function method1(): mixed {}
+ public function method2(): array|object {}
+ public function method3(iterable $x) {}
+ public function method4(iterable $x) {}
+}
+
+class B extends A {
+ public function method1(): iterable {}
+ public function method2(): iterable {}
+ public function method3(mixed $x) {}
+ public function method4(array|object $x) {}
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/bug80404.phpt b/Zend/tests/bug80404.phpt
new file mode 100644
index 0000000000..e16b9c08b3
--- /dev/null
+++ b/Zend/tests/bug80404.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #80404: Incorrect range inference result when division results in float
+--FILE--
+<?php
+
+$n = 63;
+var_dump((int) ($n / 120 * 100));
+
+?>
+--EXPECT--
+int(52)
diff --git a/Zend/tests/bug80781.phpt b/Zend/tests/bug80781.phpt
index 3e8715dc0c..eb5109add9 100644
--- a/Zend/tests/bug80781.phpt
+++ b/Zend/tests/bug80781.phpt
@@ -25,8 +25,7 @@ if (isset($array[$data]) or getPlugin($data)) {
?>
--EXPECTF--
-Fatal error: Uncaught ErrorException: Illegal offset type in isset or empty in %s:%d
+Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in %s:%d
Stack trace:
-#0 %s(%d): handle(2, 'Illegal offset ...', %s, %d, Array)
-#1 {main}
+#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug80811.phpt b/Zend/tests/bug80811.phpt
new file mode 100644
index 0000000000..e9f6443db1
--- /dev/null
+++ b/Zend/tests/bug80811.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #80811: Function exec without $output but with $restult_code parameter crashes
+--FILE--
+<?php
+
+echo 'Executing with all params:' . PHP_EOL;
+exec('echo Something', output: $output, result_code: $resultCode);
+var_dump($resultCode);
+
+echo 'Executing without output param:' . PHP_EOL;
+exec('echo Something', result_code: $resultCode);
+var_dump($resultCode);
+
+?>
+--EXPECT--
+Executing with all params:
+int(0)
+Executing without output param:
+int(0)
diff --git a/Zend/tests/bug_debug_backtrace.phpt b/Zend/tests/bug_debug_backtrace.phpt
index 71ce129201..95530e01e4 100644
--- a/Zend/tests/bug_debug_backtrace.phpt
+++ b/Zend/tests/bug_debug_backtrace.phpt
@@ -18,11 +18,9 @@ eval("foo();");
echo "Done\n";
?>
-===DONE===
--EXPECTF--
#0 boo() called at [%s:%d]
#1 bar() called at [%s:%d]
#2 foo() called at [%s(%d) : eval()'d code:1]
#3 eval() called at [%s:%d]
Done
-===DONE===
diff --git a/Zend/tests/call_static.phpt b/Zend/tests/call_static.phpt
index 355a1570f3..80aec15f45 100644
--- a/Zend/tests/call_static.phpt
+++ b/Zend/tests/call_static.phpt
@@ -4,15 +4,16 @@ __callStatic() Magic method
<?php
class Test
{
- static function __callStatic($fname, $args)
- {
- echo $fname, '() called with ', count($args), " arguments\n";
- }
+ static function __callStatic($fname, $args)
+ {
+ echo $fname, '() called with ', count($args), " arguments\n";
+ }
}
call_user_func("Test::Two", 'A', 'B');
call_user_func(array("Test", "Three"), NULL, 0, false);
Test::Four(5, 6, 7, 8);
+?>
--EXPECT--
Two() called with 2 arguments
Three() called with 3 arguments
diff --git a/Zend/tests/call_static_002.phpt b/Zend/tests/call_static_002.phpt
index ac30636ded..3c633aa712 100644
--- a/Zend/tests/call_static_002.phpt
+++ b/Zend/tests/call_static_002.phpt
@@ -4,14 +4,14 @@ Testing __call and __callstatic with callbacks
<?php
class Foo {
- public function __call($a, $b) {
- print "nonstatic\n";
- var_dump($a);
- }
- static public function __callStatic($a, $b) {
- print "static\n";
- var_dump($a);
- }
+ public function __call($a, $b) {
+ print "nonstatic\n";
+ var_dump($a);
+ }
+ static public function __callStatic($a, $b) {
+ print "static\n";
+ var_dump($a);
+ }
}
$a = new Foo;
diff --git a/Zend/tests/call_static_003.phpt b/Zend/tests/call_static_003.phpt
index 566ff0fdf2..adfd1b3318 100644
--- a/Zend/tests/call_static_003.phpt
+++ b/Zend/tests/call_static_003.phpt
@@ -4,19 +4,19 @@ Testing method name case
<?php
class Foo {
- public function __call($a, $b) {
- print "nonstatic\n";
- var_dump($a);
- }
- static public function __callStatic($a, $b) {
- print "static\n";
- var_dump($a);
- }
- public function test() {
- $this->fOoBaR();
- self::foOBAr();
- $this::fOOBAr();
- }
+ public function __call($a, $b) {
+ print "nonstatic\n";
+ var_dump($a);
+ }
+ static public function __callStatic($a, $b) {
+ print "static\n";
+ var_dump($a);
+ }
+ public function test() {
+ $this->fOoBaR();
+ self::foOBAr();
+ $this::fOOBAr();
+ }
}
$a = new Foo;
diff --git a/Zend/tests/call_static_004.phpt b/Zend/tests/call_static_004.phpt
index 427c12fc96..af49b1b2a2 100644
--- a/Zend/tests/call_static_004.phpt
+++ b/Zend/tests/call_static_004.phpt
@@ -4,9 +4,9 @@ Invalid method name in dynamic static call
<?php
class foo {
- static function __callstatic($a, $b) {
- var_dump($a);
- }
+ static function __callstatic($a, $b) {
+ var_dump($a);
+ }
}
foo::AaA();
@@ -18,7 +18,7 @@ foo::$a();
--EXPECTF--
string(3) "AaA"
-Fatal error: Uncaught Error: Function name must be a string in %s:%d
+Fatal error: Uncaught Error: Method name must be a string in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/call_static_006.phpt b/Zend/tests/call_static_006.phpt
index 2887afa355..2439f14893 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);
- }
+ 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_static_007.phpt b/Zend/tests/call_static_007.phpt
index 419f102310..00ae448b9a 100644
--- a/Zend/tests/call_static_007.phpt
+++ b/Zend/tests/call_static_007.phpt
@@ -4,15 +4,15 @@ Testing __call and __callstatic
<?php
class a {
- public function __call($a, $b) {
- print "__call: ". $a ."\n";
- }
- static public function __callStatic($a, $b) {
- print "__callstatic: ". $a ."\n";
- }
- public function baz() {
- self::Bar();
- }
+ public function __call($a, $b) {
+ print "__call: ". $a ."\n";
+ }
+ static public function __callStatic($a, $b) {
+ print "__callstatic: ". $a ."\n";
+ }
+ public function baz() {
+ self::Bar();
+ }
}
diff --git a/Zend/tests/call_to_deprecated_function_args.phpt b/Zend/tests/call_to_deprecated_function_args.phpt
index 5c3eb9ae16..c7781e30e0 100644
--- a/Zend/tests/call_to_deprecated_function_args.phpt
+++ b/Zend/tests/call_to_deprecated_function_args.phpt
@@ -1,5 +1,8 @@
--TEST--
Check that arguments are freed when calling a deprecated function
+--SKIPIF--
+<?php
+if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
--FILE--
<?php
@@ -8,20 +11,20 @@ set_error_handler(function($code, $msg) {
});
try {
- ezmlm_hash(new stdClass);
+ zend_test_deprecated(new stdClass);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
$ret = new stdClass;
try {
- $ret = ezmlm_hash(new stdClass);
+ $ret = zend_test_deprecated(new stdClass());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
- $fn = 'ezmlm_hash';
+ $fn = 'zend_test_deprecated';
$fn(new stdClass);
} catch (Error $e) {
echo $e->getMessage(), "\n";
@@ -29,7 +32,7 @@ try {
$ret = new stdClass;
try {
- $fn = 'ezmlm_hash';
+ $fn = 'zend_test_deprecated';
$ret = $fn(new stdClass);
} catch (Error $e) {
echo $e->getMessage(), "\n";
@@ -37,7 +40,7 @@ try {
?>
--EXPECT--
-Function ezmlm_hash() is deprecated
-Function ezmlm_hash() is deprecated
-Function ezmlm_hash() is deprecated
-Function ezmlm_hash() is deprecated
+Function zend_test_deprecated() is deprecated
+Function zend_test_deprecated() is deprecated
+Function zend_test_deprecated() is deprecated
+Function zend_test_deprecated() is deprecated
diff --git a/Zend/tests/call_user_func_001.phpt b/Zend/tests/call_user_func_001.phpt
index 15d0aec263..9497d305e2 100644
--- a/Zend/tests/call_user_func_001.phpt
+++ b/Zend/tests/call_user_func_001.phpt
@@ -4,32 +4,38 @@ Testing call_user_func inside namespace
<?php
namespace testing {
- function foobar($str) {
- var_dump($str);
- }
+ function foobar($str) {
+ var_dump($str);
+ }
- abstract class bar {
- protected function prot($str) {
- print "Shouldn't be called!\n";
- }
- }
- class foo extends bar {
- private function priv($str) {
- print "Shouldn't be called!\n";
- }
- }
+ abstract class bar {
+ protected function prot($str) {
+ print "Shouldn't be called!\n";
+ }
+ }
+ class foo extends bar {
+ private function priv($str) {
+ print "Shouldn't be called!\n";
+ }
+ }
- call_user_func(__NAMESPACE__ .'\foobar', 'foobar');
+ 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');
+ $class = __NAMESPACE__ .'\foo';
+ 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(): Argument #1 ($callback) must be a valid callback, cannot access private method testing\foo::priv()
+call_user_func(): Argument #1 ($callback) must 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..4f2d97182e 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(): Argument #1 ($function) must be a valid callback, class "foo" not found
+call_user_func(): Argument #1 ($function) must 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(): Argument #1 ($function) must 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(): Argument #1 ($function) must be a valid callback, first array member is not a valid class name or object
diff --git a/Zend/tests/call_user_func_003.phpt b/Zend/tests/call_user_func_003.phpt
index 1aad22fba7..b501d803e7 100644
--- a/Zend/tests/call_user_func_003.phpt
+++ b/Zend/tests/call_user_func_003.phpt
@@ -4,15 +4,15 @@ Testing call_user_func() with closures
<?php
$foo = function() {
- static $instance;
+ static $instance;
- if (is_null($instance)) {
- $instance = function () {
- return 'OK!';
- };
- }
+ if (is_null($instance)) {
+ $instance = function () {
+ return 'OK!';
+ };
+ }
- return $instance;
+ return $instance;
};
var_dump(call_user_func(array($foo, '__invoke'))->__invoke());
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..2f5220db62 100644
--- a/Zend/tests/call_user_func_005.phpt
+++ b/Zend/tests/call_user_func_005.phpt
@@ -4,21 +4,21 @@ Passing Closure as parameter to an non-existent function
<?php
class foo {
- public static function __callstatic($x, $y) {
- var_dump($x,$y);
- return 1;
- }
+ public static function __callstatic($x, $y) {
+ var_dump($x,$y);
+ return 1;
+ }
- public function teste() {
- return foo::x(function &($a=1,$b) { });
- }
+ public static function teste() {
+ return foo::x(function &($a=1,$b) { });
+ }
}
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
+Deprecated: Required parameter $b follows optional parameter $a in %s on line %d
string(1) "x"
array(1) {
[0]=>
diff --git a/Zend/tests/call_user_func_006.phpt b/Zend/tests/call_user_func_006.phpt
index 16a59bcf5b..e45c81dc10 100644
--- a/Zend/tests/call_user_func_006.phpt
+++ b/Zend/tests/call_user_func_006.phpt
@@ -21,8 +21,8 @@ var_dump($y);
?>
--EXPECTF--
-Warning: Parameter 1 to Foo\bar() expected to be a reference, value given in %s on line %d
+Warning: Foo\bar(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d
int(42)
-Warning: Parameter 1 to Foo\bar() expected to be a reference, value given in %s on line %d
+Warning: Foo\bar(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d
int(42)
diff --git a/Zend/tests/call_user_func_007.phpt b/Zend/tests/call_user_func_007.phpt
index ed44320c3f..08083e71a9 100644
--- a/Zend/tests/call_user_func_007.phpt
+++ b/Zend/tests/call_user_func_007.phpt
@@ -11,10 +11,10 @@ var_dump($a);
?>
--EXPECTF--
-Notice: Undefined offset: 0 in %s on line %d
+Warning: Undefined array key 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
+Warning: foo(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d
array(0) {
}
diff --git a/Zend/tests/call_user_func_008.phpt b/Zend/tests/call_user_func_008.phpt
index 3e727e7f43..1d20bc60d6 100644
--- a/Zend/tests/call_user_func_008.phpt
+++ b/Zend/tests/call_user_func_008.phpt
@@ -25,30 +25,30 @@ var_dump($i, $j);
?>
--EXPECTF--
-Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
+Warning: test(): Argument #1 ($ref1) must be passed by reference, value given in %s on line %d
-Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
+Warning: test(): Argument #2 ($ref2) must be passed by reference, value given in %s on line %d
bool(true)
int(0)
int(0)
-Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
+Warning: test(): Argument #1 ($ref1) must be passed by reference, value given in %s on line %d
-Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
+Warning: test(): Argument #2 ($ref2) must be passed by reference, value given in %s on line %d
bool(true)
int(0)
int(0)
-Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
+Warning: test(): Argument #1 ($ref1) must be passed by reference, value given in %s on line %d
-Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
+Warning: test(): Argument #2 ($ref2) must be passed by reference, value given in %s on line %d
bool(true)
int(0)
int(0)
-Warning: Parameter 1 to test() expected to be a reference, value given in %s on line %d
+Warning: test(): Argument #1 ($ref1) must be passed by reference, value given in %s on line %d
-Warning: Parameter 2 to test() expected to be a reference, value given in %s on line %d
+Warning: test(): Argument #2 ($ref2) must be passed by reference, value given in %s on line %d
bool(true)
int(0)
int(0)
diff --git a/Zend/tests/call_user_func_009.phpt b/Zend/tests/call_user_func_009.phpt
index d45380db15..7224dc06fa 100644
--- a/Zend/tests/call_user_func_009.phpt
+++ b/Zend/tests/call_user_func_009.phpt
@@ -10,8 +10,8 @@ var_dump(\call_user_func('sort', []));
?>
--EXPECTF--
-Warning: Parameter 1 to sort() expected to be a reference, value given in %s on line %d
+Warning: sort(): Argument #1 ($array) must be passed by reference, value given in %s on line %d
bool(true)
-Warning: Parameter 1 to sort() expected to be a reference, value given in %s on line %d
+Warning: sort(): Argument #1 ($array) must be passed by reference, value given in %s on line %d
bool(true)
diff --git a/Zend/tests/call_user_func_array_array_slice_named_args.phpt b/Zend/tests/call_user_func_array_array_slice_named_args.phpt
new file mode 100644
index 0000000000..2d84ec4776
--- /dev/null
+++ b/Zend/tests/call_user_func_array_array_slice_named_args.phpt
@@ -0,0 +1,8 @@
+--TEST--
+call_user_func_array() + array_slice() + named arguments
+--FILE--
+<?php
+call_user_func_array('func', array_slice(array: $a, 1, 2));
+?>
+--EXPECTF--
+Fatal error: Cannot use positional argument after named argument in %s on line %d
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..785a6e35e9
--- /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(): Argument #2 ($args) must be of type 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 6ab18b3763..0000000000
--- a/Zend/tests/case_insensitive_constant_deprecation.phpt
+++ /dev/null
@@ -1,131 +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(\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)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 9
-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 13
-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 22
-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 25
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 30
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 35
-int(24)
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 40
-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 49
-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 52
-int(24)
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 56
-int(42)
-int(43)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 60
-int(43)
diff --git a/Zend/tests/cast_to_array.phpt b/Zend/tests/cast_to_array.phpt
index 12261c8e84..f43879df5f 100644
--- a/Zend/tests/cast_to_array.phpt
+++ b/Zend/tests/cast_to_array.phpt
Binary files differ
diff --git a/Zend/tests/cast_to_bool.phpt b/Zend/tests/cast_to_bool.phpt
index ebb1df6dfd..ba25614bd2 100644
--- a/Zend/tests/cast_to_bool.phpt
+++ b/Zend/tests/cast_to_bool.phpt
@@ -6,32 +6,32 @@ casting different variables to boolean
$r = fopen(__FILE__, "r");
class test {
- function __toString() {
- return "10";
- }
+ function __toString() {
+ return "10";
+ }
}
$o = new test;
$vars = array(
- "string",
- "8754456",
- "",
- "\0",
- 9876545,
- 0.10,
- array(),
- array(1,2,3),
- false,
- true,
- NULL,
- $r,
- $o
+ "string",
+ "8754456",
+ "",
+ "\0",
+ 9876545,
+ 0.10,
+ array(),
+ array(1,2,3),
+ false,
+ true,
+ NULL,
+ $r,
+ $o
);
foreach ($vars as $var) {
- $tmp = (bool)$var;
- var_dump($tmp);
+ $tmp = (bool)$var;
+ var_dump($tmp);
}
echo "Done\n";
diff --git a/Zend/tests/cast_to_double.phpt b/Zend/tests/cast_to_double.phpt
index d2ee8ca1e9..2972fbbe80 100644
--- a/Zend/tests/cast_to_double.phpt
+++ b/Zend/tests/cast_to_double.phpt
@@ -8,32 +8,32 @@ precision=14
$r = fopen(__FILE__, "r");
class test {
- function __toString() {
- return "10";
- }
+ function __toString() {
+ return "10";
+ }
}
$o = new test;
$vars = array(
- "string",
- "8754456",
- "",
- "\0",
- 9876545,
- 0.10,
- array(),
- array(1,2,3),
- false,
- true,
- NULL,
- $r,
- $o
+ "string",
+ "8754456",
+ "",
+ "\0",
+ 9876545,
+ 0.10,
+ array(),
+ array(1,2,3),
+ false,
+ true,
+ NULL,
+ $r,
+ $o
);
foreach ($vars as $var) {
- $tmp = (double)$var;
- var_dump($tmp);
+ $tmp = (double)$var;
+ var_dump($tmp);
}
echo "Done\n";
@@ -50,8 +50,8 @@ float(1)
float(0)
float(1)
float(0)
-float(%d)
+float(%f)
-Notice: Object of class test could not be converted to float in %s on line %d
+Warning: Object of class test could not be converted to float in %s on line %d
float(1)
Done
diff --git a/Zend/tests/cast_to_int.phpt b/Zend/tests/cast_to_int.phpt
index 2a637e15e5..6451c4a2f7 100644
--- a/Zend/tests/cast_to_int.phpt
+++ b/Zend/tests/cast_to_int.phpt
@@ -6,32 +6,32 @@ casting different variables to integer
$r = fopen(__FILE__, "r");
class test {
- function __toString() {
- return "10";
- }
+ function __toString() {
+ return "10";
+ }
}
$o = new test;
$vars = array(
- "string",
- "8754456",
- "",
- "\0",
- 9876545,
- 0.10,
- array(),
- array(1,2,3),
- false,
- true,
- NULL,
- $r,
- $o
+ "string",
+ "8754456",
+ "",
+ "\0",
+ 9876545,
+ 0.10,
+ array(),
+ array(1,2,3),
+ false,
+ true,
+ NULL,
+ $r,
+ $o
);
foreach ($vars as $var) {
- $tmp = (int)$var;
- var_dump($tmp);
+ $tmp = (int)$var;
+ var_dump($tmp);
}
echo "Done\n";
@@ -50,6 +50,6 @@ int(1)
int(0)
int(%d)
-Notice: Object of class test could not be converted to int in %s on line %d
+Warning: Object of class test could not be converted to int in %s on line %d
int(1)
Done
diff --git a/Zend/tests/cast_to_object.phpt b/Zend/tests/cast_to_object.phpt
index b7e5f219f6..2b0d22a6ec 100644
--- a/Zend/tests/cast_to_object.phpt
+++ b/Zend/tests/cast_to_object.phpt
Binary files differ
diff --git a/Zend/tests/cast_to_string.phpt b/Zend/tests/cast_to_string.phpt
index b3d245f1ed..1fb94dfa8d 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..e7173d2621 100644
--- a/Zend/tests/catch.phpt
+++ b/Zend/tests/catch.phpt
@@ -1,11 +1,11 @@
--TEST--
-catch shouldn't call __autoload
+catch shouldn't call autoloader
--FILE--
<?php
spl_autoload_register(function ($name) {
- echo("AUTOLOAD '$name'\n");
- eval("class $name {}");
+ echo("AUTOLOAD '$name'\n");
+ eval("class $name {}");
});
try {
@@ -16,7 +16,7 @@ try {
throw new Exception();
} catch (B $e) {
} catch (Exception $e) {
- echo "ok\n";
+ echo "ok\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/catch_static.phpt b/Zend/tests/catch_static.phpt
new file mode 100644
index 0000000000..283aef9181
--- /dev/null
+++ b/Zend/tests/catch_static.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Cannot catch "static"
+--FILE--
+<?php
+
+// This could in principle be supported, but isn't right now.
+class Test {
+ public function method() {
+ try {
+ foo();
+ } catch (static $e) {}
+ }
+}
+
+?>
+--EXPECTF--
+Fatal error: Bad class name in the catch statement in %s on line %d
diff --git a/Zend/tests/class_alias_005.phpt b/Zend/tests/class_alias_005.phpt
index ecc96c8cfa..15f5b28d50 100644
--- a/Zend/tests/class_alias_005.phpt
+++ b/Zend/tests/class_alias_005.phpt
@@ -4,9 +4,9 @@ Testing static call method using the original class name
<?php
class foo {
- static public function msg() {
- print "hello\n";
- }
+ static public function msg() {
+ print "hello\n";
+ }
}
interface test { }
@@ -15,9 +15,9 @@ interface test { }
class_alias('foo', 'baz');
class bar extends baz {
- public function __construct() {
- foo::msg();
- }
+ public function __construct() {
+ foo::msg();
+ }
}
new bar;
diff --git a/Zend/tests/class_alias_006.phpt b/Zend/tests/class_alias_006.phpt
index d14ad7c933..8fe2ac509a 100644
--- a/Zend/tests/class_alias_006.phpt
+++ b/Zend/tests/class_alias_006.phpt
@@ -3,8 +3,12 @@ Testing creation of alias to an internal class
--FILE--
<?php
-class_alias('stdclass', 'foo');
+try {
+ class_alias('stdclass', 'foo');
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: First argument of class_alias() must be a name of user defined class in %s on line %d
+--EXPECT--
+class_alias(): Argument #1 ($class) must be a user-defined class name, internal class name given
diff --git a/Zend/tests/class_alias_007.phpt b/Zend/tests/class_alias_007.phpt
index edcc096ade..eb953dc15c 100644
--- a/Zend/tests/class_alias_007.phpt
+++ b/Zend/tests/class_alias_007.phpt
@@ -4,7 +4,7 @@ Testing class_alias() using autoload
<?php
spl_autoload_register(function ($a) {
- class foo { }
+ class foo { }
});
class_alias('foo', 'bar', 1);
diff --git a/Zend/tests/class_alias_011.phpt b/Zend/tests/class_alias_011.phpt
index 6db2ec7b58..ab1343e484 100644
--- a/Zend/tests/class_alias_011.phpt
+++ b/Zend/tests/class_alias_011.phpt
@@ -4,12 +4,12 @@ Testing callback in alias
<?php
class foo {
- static public function test() {
- print "hello\n";
- }
- public function test2() {
- print "foobar!\n";
- }
+ static public function test() {
+ print "hello\n";
+ }
+ public function test2() {
+ print "foobar!\n";
+ }
}
class_alias('FOO', 'bar');
diff --git a/Zend/tests/class_alias_014.phpt b/Zend/tests/class_alias_014.phpt
index 7c4bdb9b04..d566f986b6 100644
--- a/Zend/tests/class_alias_014.phpt
+++ b/Zend/tests/class_alias_014.phpt
@@ -12,4 +12,4 @@ class_alias('bar', 'baz');
?>
--EXPECTF--
-Warning: Class 'bar' not found in %s on line %d
+Warning: Class "bar" not found in %s on line %d
diff --git a/Zend/tests/class_alias_016.phpt b/Zend/tests/class_alias_016.phpt
index 1d2b6752a4..59afa6ca2a 100644
--- a/Zend/tests/class_alias_016.phpt
+++ b/Zend/tests/class_alias_016.phpt
@@ -18,7 +18,7 @@ var_dump(new foo);
object(foo\bar)#%d (0) {
}
-Fatal error: Uncaught Error: Class 'foo\foo' not found in %s:%d
+Fatal error: Uncaught Error: Class "foo\foo" not found in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/class_alias_017.phpt b/Zend/tests/class_alias_017.phpt
index 555e776227..bc2eaf5467 100644
--- a/Zend/tests/class_alias_017.phpt
+++ b/Zend/tests/class_alias_017.phpt
@@ -4,12 +4,12 @@ Testing alias with get_called_class() and get_class()
<?php
class foo {
- public function __construct() {
- echo get_called_class(), "\n";
- }
- static public function test() {
- echo get_class(), "\n";
- }
+ public function __construct() {
+ echo get_called_class(), "\n";
+ }
+ static public function test() {
+ echo get_class(), "\n";
+ }
}
class_alias('foo', 'bar');
diff --git a/Zend/tests/class_alias_020.phpt b/Zend/tests/class_alias_020.phpt
index ba330e4ae5..665af2a2f7 100644
--- a/Zend/tests/class_alias_020.phpt
+++ b/Zend/tests/class_alias_020.phpt
@@ -30,7 +30,7 @@ object(foo\foo)#1 (0) {
object(foo\bar\foo)#2 (0) {
}
-Fatal error: Uncaught Error: Class 'foo\bar' not found in %s:%d
+Fatal error: Uncaught Error: Class "foo\bar" not found in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/class_constants_001.phpt b/Zend/tests/class_constants_001.phpt
index f36b1af9f6..8cea480a0d 100644
--- a/Zend/tests/class_constants_001.phpt
+++ b/Zend/tests/class_constants_001.phpt
@@ -4,8 +4,8 @@ class constants basic tests
<?php
class test {
- const val = "string";
- const val2 = 1;
+ const val = "string";
+ const val2 = 1;
}
var_dump(test::val);
@@ -19,7 +19,7 @@ echo "Done\n";
string(6) "string"
int(1)
-Fatal error: Uncaught Error: Undefined class constant 'val3' in %s:%d
+Fatal error: Uncaught Error: Undefined constant test::val3 in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/class_constants_002.phpt b/Zend/tests/class_constants_002.phpt
index 259c724372..3e51ab8908 100644
--- a/Zend/tests/class_constants_002.phpt
+++ b/Zend/tests/class_constants_002.phpt
@@ -4,15 +4,15 @@ class constants as default function arguments
<?php
class test {
- const val = 1;
+ const val = 1;
}
function foo($v = test::val) {
- var_dump($v);
+ var_dump($v);
}
function bar($b = NoSuchClass::val) {
- var_dump($b);
+ var_dump($b);
}
foo();
@@ -28,7 +28,7 @@ int(1)
int(5)
int(10)
-Fatal error: Uncaught Error: Class 'NoSuchClass' not found in %s:%d
+Fatal error: Uncaught Error: Class "NoSuchClass" not found in %s:%d
Stack trace:
#0 %s(%d): bar()
#1 {main}
diff --git a/Zend/tests/class_constants_003.phpt b/Zend/tests/class_constants_003.phpt
index 3e61a8ab97..dcf94aaa0b 100644
--- a/Zend/tests/class_constants_003.phpt
+++ b/Zend/tests/class_constants_003.phpt
@@ -6,7 +6,7 @@ class constants as default function arguments and dynamically loaded classes
$class_data = <<<DATA
<?php
class test {
- const val = 1;
+ const val = 1;
}
?>
DATA;
@@ -15,7 +15,7 @@ $filename = __DIR__."/cc003.dat";
file_put_contents($filename, $class_data);
function foo($v = test::val) {
- var_dump($v);
+ var_dump($v);
}
include $filename;
diff --git a/Zend/tests/class_constants_004.phpt b/Zend/tests/class_constants_004.phpt
index 1ca49ebdf0..7f1247e6fd 100644
--- a/Zend/tests/class_constants_004.phpt
+++ b/Zend/tests/class_constants_004.phpt
@@ -10,26 +10,26 @@ define('foo', 3);
const foo = 1;
class foo {
- const foo = 2;
+ const foo = 2;
}
interface Ifoo {
- const foo = 4;
+ const foo = 4;
}
$const = __NAMESPACE__ .'\\foo'; // class
$const2 = __NAMESPACE__ .'\\Ifoo'; // interface
var_dump( foo,
- \foo\foo,
- namespace\foo,
- \foo\foo::foo,
- $const::foo,
- \foo,
- constant('foo'),
- Ifoo::foo,
- $const2::foo
- );
+ \foo\foo,
+ namespace\foo,
+ \foo\foo::foo,
+ $const::foo,
+ \foo,
+ constant('foo'),
+ Ifoo::foo,
+ $const2::foo
+ );
?>
--EXPECT--
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_name_as_scalar_error_005.phpt b/Zend/tests/class_name_as_scalar_error_005.phpt
index cbfaf108e2..14444bdae2 100644
--- a/Zend/tests/class_name_as_scalar_error_005.phpt
+++ b/Zend/tests/class_name_as_scalar_error_005.phpt
@@ -7,7 +7,7 @@ $x = static::class;
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot use "static" when no class scope is active in %s:3
+Fatal error: Uncaught Error: Cannot use "static" in the global scope in %s:%d
Stack trace:
#0 {main}
thrown in %s on line 3
diff --git a/Zend/tests/class_name_as_scalar_error_006.phpt b/Zend/tests/class_name_as_scalar_error_006.phpt
index 185e9f6be1..38c93cffd2 100644
--- a/Zend/tests/class_name_as_scalar_error_006.phpt
+++ b/Zend/tests/class_name_as_scalar_error_006.phpt
@@ -7,7 +7,7 @@ $x = parent::class;
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot use "parent" when no class scope is active in %s:3
+Fatal error: Uncaught Error: Cannot use "parent" in the global scope in %s:%d
Stack trace:
#0 {main}
thrown in %s on line 3
diff --git a/Zend/tests/class_name_as_scalar_error_007.phpt b/Zend/tests/class_name_as_scalar_error_007.phpt
index cbaf518ea8..a550cdd2b0 100644
--- a/Zend/tests/class_name_as_scalar_error_007.phpt
+++ b/Zend/tests/class_name_as_scalar_error_007.phpt
@@ -16,5 +16,5 @@ try {
?>
--EXPECT--
-Cannot use "self" when no class scope is active
-Cannot use "self" when no class scope is active
+Cannot use "self" in the global scope
+Cannot use "self" in the global scope
diff --git a/Zend/tests/class_name_of_var.phpt b/Zend/tests/class_name_of_var.phpt
deleted file mode 100644
index 29f19e9fac..0000000000
--- a/Zend/tests/class_name_of_var.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-$var::class is not supported
---FILE--
-<?php
-
-$obj = new stdClass;
-var_dump($obj::class);
-
-?>
---EXPECTF--
-Fatal error: Cannot use ::class with dynamic class name in %s on line %d
diff --git a/Zend/tests/class_on_constant_evaluated_expression.phpt b/Zend/tests/class_on_constant_evaluated_expression.phpt
new file mode 100644
index 0000000000..c70262c20d
--- /dev/null
+++ b/Zend/tests/class_on_constant_evaluated_expression.phpt
@@ -0,0 +1,10 @@
+--TEST--
+An error should be generated when using ::class on a constant evaluated expression
+--FILE--
+<?php
+
+(1+1)::class;
+
+?>
+--EXPECTF--
+Fatal error: Cannot use "::class" on value of type int in %s on line %d
diff --git a/Zend/tests/class_on_expression_in_constant_expression.phpt b/Zend/tests/class_on_expression_in_constant_expression.phpt
new file mode 100644
index 0000000000..f6b739c634
--- /dev/null
+++ b/Zend/tests/class_on_expression_in_constant_expression.phpt
@@ -0,0 +1,10 @@
+--TEST--
+::class on an expression cannot be used inside constant expressions
+--FILE--
+<?php
+
+const A = [0]::class;
+
+?>
+--EXPECTF--
+Fatal error: (expression)::class cannot be used in constant expressions in %s on line %d
diff --git a/Zend/tests/class_on_object.phpt b/Zend/tests/class_on_object.phpt
new file mode 100644
index 0000000000..c316eff3e4
--- /dev/null
+++ b/Zend/tests/class_on_object.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Using ::class on an object
+--FILE--
+<?php
+
+$obj = new stdClass;
+var_dump($obj::class);
+$ref =& $obj;
+var_dump($ref::class);
+var_dump((new stdClass)::class);
+
+// Placed in a function to check that opcache doesn't perform incorrect constprop.
+function test() {
+ $other = null;
+ var_dump($other::class);
+}
+try {
+ test();
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+string(8) "stdClass"
+string(8) "stdClass"
+string(8) "stdClass"
+Cannot use "::class" on value of type null
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/class_properties_dynamic.phpt b/Zend/tests/class_properties_dynamic.phpt
index 456bcf4a5b..db8ed9b7d0 100644
--- a/Zend/tests/class_properties_dynamic.phpt
+++ b/Zend/tests/class_properties_dynamic.phpt
@@ -3,9 +3,9 @@ Class Property Expressions
--FILE--
<?php
class Foo {
- const BAR = 1 << 0;
- const BAZ = 1 << 1;
- public $bar = self::BAR | self::BAZ;
+ const BAR = 1 << 0;
+ const BAZ = 1 << 1;
+ public $bar = self::BAR | self::BAZ;
}
echo (new Foo)->bar;
?>
diff --git a/Zend/tests/class_properties_static.phpt b/Zend/tests/class_properties_static.phpt
index 9a56466340..309c0f7ef4 100644
--- a/Zend/tests/class_properties_static.phpt
+++ b/Zend/tests/class_properties_static.phpt
@@ -3,15 +3,15 @@ Static Class Property Expressions
--FILE--
<?php
class Foo {
- public $b1 = 1 + 1;
- public $b2 = 1 << 2;
- public $b3 = "foo " . " bar " . " baz";
+ public $b1 = 1 + 1;
+ public $b2 = 1 << 2;
+ public $b3 = "foo " . " bar " . " baz";
}
$f = new Foo;
var_dump(
- $f->b1,
- $f->b2,
- $f->b3
+ $f->b1,
+ $f->b2,
+ $f->b3
);
?>
--EXPECT--
diff --git a/Zend/tests/class_uses_static.phpt b/Zend/tests/class_uses_static.phpt
new file mode 100644
index 0000000000..df34e5b6af
--- /dev/null
+++ b/Zend/tests/class_uses_static.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Class cannot use static as a trait, as it is reserved
+--FILE--
+<?php
+
+class Test {
+ use static;
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use 'static' as trait name, as it is reserved in %s on line %d
diff --git a/Zend/tests/clone_003.phpt b/Zend/tests/clone_003.phpt
index 2dd376cf65..f163616a87 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/clone_004.phpt b/Zend/tests/clone_004.phpt
index c97bb032c0..812eb6dfdd 100644
--- a/Zend/tests/clone_004.phpt
+++ b/Zend/tests/clone_004.phpt
@@ -4,9 +4,9 @@ Testing usage of object as array on clone statement
<?php
class foo {
- public function __get($a) {
- return new $this;
- }
+ public function __get($a) {
+ return new $this;
+ }
}
$c = new foo;
diff --git a/Zend/tests/closure_001.phpt b/Zend/tests/closure_001.phpt
index 7385c42f12..1c379c8c49 100644
--- a/Zend/tests/closure_001.phpt
+++ b/Zend/tests/closure_001.phpt
@@ -4,11 +4,11 @@ Closure 001: Lambda without lexical variables
<?php
$lambda1 = function () {
- echo "Hello World!\n";
+ echo "Hello World!\n";
};
$lambda2 = function ($x) {
- echo "Hello $x!\n";
+ echo "Hello $x!\n";
};
var_dump(is_callable($lambda1));
diff --git a/Zend/tests/closure_002.phpt b/Zend/tests/closure_002.phpt
index 023d4ecff1..80483f7994 100644
--- a/Zend/tests/closure_002.phpt
+++ b/Zend/tests/closure_002.phpt
@@ -6,11 +6,11 @@ Closure 002: Lambda with lexical variables (global scope)
$x = 4;
$lambda1 = function () use ($x) {
- echo "$x\n";
+ echo "$x\n";
};
$lambda2 = function () use (&$x) {
- echo "$x\n";
+ echo "$x\n";
};
$lambda1();
diff --git a/Zend/tests/closure_003.phpt b/Zend/tests/closure_003.phpt
index 6f5cc70bf1..64a956ed4f 100644
--- a/Zend/tests/closure_003.phpt
+++ b/Zend/tests/closure_003.phpt
@@ -4,21 +4,21 @@ Closure 003: Lambda with lexical variables (local scope)
<?php
function run () {
- $x = 4;
+ $x = 4;
- $lambda1 = function () use ($x) {
- echo "$x\n";
- };
+ $lambda1 = function () use ($x) {
+ echo "$x\n";
+ };
- $lambda2 = function () use (&$x) {
- echo "$x\n";
- };
+ $lambda2 = function () use (&$x) {
+ echo "$x\n";
+ };
- $lambda1();
- $lambda2();
- $x++;
- $lambda1();
- $lambda2();
+ $lambda1();
+ $lambda2();
+ $x++;
+ $lambda1();
+ $lambda2();
}
run();
diff --git a/Zend/tests/closure_004.phpt b/Zend/tests/closure_004.phpt
index c1c2efb25c..c3de1372e9 100644
--- a/Zend/tests/closure_004.phpt
+++ b/Zend/tests/closure_004.phpt
@@ -4,18 +4,18 @@ Closure 004: Lambda with lexical variables (scope lifetime)
<?php
function run () {
- $x = 4;
+ $x = 4;
- $lambda1 = function () use ($x) {
- echo "$x\n";
- };
+ $lambda1 = function () use ($x) {
+ echo "$x\n";
+ };
- $lambda2 = function () use (&$x) {
- echo "$x\n";
- $x++;
- };
+ $lambda2 = function () use (&$x) {
+ echo "$x\n";
+ $x++;
+ };
- return array($lambda1, $lambda2);
+ return array($lambda1, $lambda2);
}
list ($lambda1, $lambda2) = run();
diff --git a/Zend/tests/closure_005.phpt b/Zend/tests/closure_005.phpt
index b3be877216..52b8d49059 100644
--- a/Zend/tests/closure_005.phpt
+++ b/Zend/tests/closure_005.phpt
@@ -4,37 +4,37 @@ Closure 005: Lambda inside class, lifetime of $this
<?php
class A {
- private $x;
-
- function __construct($x) {
- $this->x = $x;
- }
-
- function __destruct() {
- echo "Destroyed\n";
- }
-
- function getIncer($val) {
- return function() use ($val) {
- $this->x += $val;
- };
- }
-
- function getPrinter() {
- return function() {
- echo $this->x."\n";
- };
- }
-
- function getError() {
- return static function() {
- echo $this->x."\n";
- };
- }
-
- function printX() {
- echo $this->x."\n";
- }
+ private $x;
+
+ function __construct($x) {
+ $this->x = $x;
+ }
+
+ function __destruct() {
+ echo "Destroyed\n";
+ }
+
+ function getIncer($val) {
+ return function() use ($val) {
+ $this->x += $val;
+ };
+ }
+
+ function getPrinter() {
+ return function() {
+ echo $this->x."\n";
+ };
+ }
+
+ function getError() {
+ return static function() {
+ echo $this->x."\n";
+ };
+ }
+
+ function printX() {
+ echo $this->x."\n";
+ }
}
$a = new A(3);
diff --git a/Zend/tests/closure_006.phpt b/Zend/tests/closure_006.phpt
index aa0ec11995..a3707cb1f7 100644
--- a/Zend/tests/closure_006.phpt
+++ b/Zend/tests/closure_006.phpt
@@ -4,9 +4,9 @@ Closure 006: Nested lambdas
<?php
$getClosure = function ($v) {
- return function () use ($v) {
- echo "Hello World: $v!\n";
- };
+ return function () use ($v) {
+ echo "Hello World: $v!\n";
+ };
};
$closure = $getClosure (2);
diff --git a/Zend/tests/closure_007.phpt b/Zend/tests/closure_007.phpt
index 89cd06d8a1..f484b56a35 100644
--- a/Zend/tests/closure_007.phpt
+++ b/Zend/tests/closure_007.phpt
@@ -4,19 +4,19 @@ Closure 007: Nested lambdas in classes
<?php
class A {
- private $x = 0;
+ private $x = 0;
- function getClosureGetter () {
- return function () {
- return function () {
- $this->x++;
- };
- };
- }
+ function getClosureGetter () {
+ return function () {
+ return function () {
+ $this->x++;
+ };
+ };
+ }
- function printX () {
- echo $this->x."\n";
- }
+ function printX () {
+ echo $this->x."\n";
+ }
}
$a = new A;
diff --git a/Zend/tests/closure_008.phpt b/Zend/tests/closure_008.phpt
index 64c7e659e6..238bbea002 100644
--- a/Zend/tests/closure_008.phpt
+++ b/Zend/tests/closure_008.phpt
@@ -4,10 +4,10 @@ Closure 008: Use in preg_replace_callback()
<?php
function replace_spaces($text) {
- $lambda = function ($matches) {
- return str_replace(' ', '&nbsp;', $matches[1]).' ';
- };
- return preg_replace_callback('/( +) /', $lambda, $text);
+ $lambda = function ($matches) {
+ return str_replace(' ', '&nbsp;', $matches[1]).' ';
+ };
+ return preg_replace_callback('/( +) /', $lambda, $text);
}
echo replace_spaces("1 2 3\n");
diff --git a/Zend/tests/closure_012.phpt b/Zend/tests/closure_012.phpt
index bae8f56878..044de936ca 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_013.phpt b/Zend/tests/closure_013.phpt
index 72d2b3f963..42622916af 100644
--- a/Zend/tests/closure_013.phpt
+++ b/Zend/tests/closure_013.phpt
@@ -3,15 +3,15 @@ Closure 013: __invoke() on temporary result
--FILE--
<?php
class Foo {
- function __invoke() {
- echo "Hello World!\n";
- }
+ function __invoke() {
+ echo "Hello World!\n";
+ }
}
function foo() {
- return function() {
- echo "Hello World!\n";
- };
+ return function() {
+ echo "Hello World!\n";
+ };
}
$test = new Foo;
$test->__invoke();
diff --git a/Zend/tests/closure_014.phpt b/Zend/tests/closure_014.phpt
index 9e4819b9dd..fbd1109dc8 100644
--- a/Zend/tests/closure_014.phpt
+++ b/Zend/tests/closure_014.phpt
@@ -3,18 +3,18 @@ Closure 014: return by value/reference
--FILE--
<?php
class C1 {
- function __invoke() {
- return 0;
- }
+ function __invoke() {
+ return 0;
+ }
}
class C2 {
- function &__invoke(&$a) {
- return $a;
- }
+ function &__invoke(&$a) {
+ return $a;
+ }
}
class C3 {
- function __invoke() {
- }
+ function __invoke() {
+ }
}
$x = new C1();
@@ -23,7 +23,7 @@ var_dump($x->__invoke());
$x();
$x->__invoke();
$x = function() {
- return 0;
+ return 0;
};
var_dump($x());
var_dump($x->__invoke());
@@ -41,7 +41,7 @@ var_dump($b);
$x($b);
$x->__invoke($b);
$x = function & (&$a) {
- return $a;
+ return $a;
};
$e =& $x($c);
$e = 4;
diff --git a/Zend/tests/closure_016.phpt b/Zend/tests/closure_016.phpt
index ae0036586c..0f87f20f43 100644
--- a/Zend/tests/closure_016.phpt
+++ b/Zend/tests/closure_016.phpt
@@ -3,15 +3,15 @@ Closure 016: closures and is_callable()
--FILE--
<?php
class Foo {
- function __invoke() {
- echo "Hello World!\n";
- }
+ function __invoke() {
+ echo "Hello World!\n";
+ }
}
function foo() {
- return function() {
- echo "Hello World!\n";
- };
+ return function() {
+ echo "Hello World!\n";
+ };
}
$test = new Foo;
var_dump(is_callable($test, true, $name));
diff --git a/Zend/tests/closure_018.phpt b/Zend/tests/closure_018.phpt
index 0241d3e8ee..9afef5b7c4 100644
--- a/Zend/tests/closure_018.phpt
+++ b/Zend/tests/closure_018.phpt
@@ -4,13 +4,13 @@ Closure 018: Assigning lambda to static var and returning by ref
<?php
class foo {
- public function test(&$x) {
- static $lambda;
- $lambda = function &() use (&$x) {
- return $x = $x * $x;
- };
- return $lambda();
- }
+ public function test(&$x) {
+ static $lambda;
+ $lambda = function &() use (&$x) {
+ return $x = $x * $x;
+ };
+ return $lambda();
+ }
}
$test = new foo;
diff --git a/Zend/tests/closure_019.phpt b/Zend/tests/closure_019.phpt
index 22aaec1bba..79341c9064 100644
--- a/Zend/tests/closure_019.phpt
+++ b/Zend/tests/closure_019.phpt
@@ -4,16 +4,16 @@ Closure 019: Calling lambda using $GLOBALS and global $var
<?php
$lambda = function &(&$x) {
- return $x = $x * $x;
+ return $x = $x * $x;
};
function test() {
- global $lambda;
+ global $lambda;
- $y = 3;
- var_dump($GLOBALS['lambda']($y));
- var_dump($lambda($y));
- var_dump($GLOBALS['lambda'](1));
+ $y = 3;
+ var_dump($GLOBALS['lambda']($y));
+ var_dump($lambda($y));
+ var_dump($GLOBALS['lambda'](1));
}
test();
@@ -26,7 +26,7 @@ int(9)
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
int(81)
-Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d
+Fatal error: Uncaught Error: {closure}(): Argument #1 ($x) cannot be passed by reference in %s:%d
Stack trace:
#0 %s(%d): test()
#1 {main}
diff --git a/Zend/tests/closure_020.phpt b/Zend/tests/closure_020.phpt
index 9325e020c3..7d98dd2dc6 100644
--- a/Zend/tests/closure_020.phpt
+++ b/Zend/tests/closure_020.phpt
@@ -4,17 +4,17 @@ Closure 020: Trying to access private property outside class
<?php
class foo {
- private $test = 3;
+ private $test = 3;
- public function x() {
- $a = &$this;
- $this->a = function() use (&$a) { return $a; };
- var_dump($this->a->__invoke());
- var_dump(is_a($this->a, 'closure'));
- var_dump(is_callable($this->a));
+ public function x() {
+ $a = &$this;
+ $this->a = function() use (&$a) { return $a; };
+ var_dump($this->a->__invoke());
+ var_dump(is_a($this->a, 'closure'));
+ var_dump(is_callable($this->a));
- return $this->a;
- }
+ return $this->a;
+ }
}
$foo = new foo;
diff --git a/Zend/tests/closure_021.phpt b/Zend/tests/closure_021.phpt
index 76be762f08..95ff7d889f 100644
--- a/Zend/tests/closure_021.phpt
+++ b/Zend/tests/closure_021.phpt
@@ -4,17 +4,17 @@ Closure 021: Throwing exception inside lambda
<?php
$foo = function() {
- try {
- throw new Exception('test!');
- } catch(Exception $e) {
- throw $e;
- }
+ try {
+ throw new Exception('test!');
+ } catch(Exception $e) {
+ throw $e;
+ }
};
try {
- $foo();
+ $foo();
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
diff --git a/Zend/tests/closure_023.phpt b/Zend/tests/closure_023.phpt
index a91d357c06..089ec8cc4d 100644
--- a/Zend/tests/closure_023.phpt
+++ b/Zend/tests/closure_023.phpt
@@ -9,5 +9,6 @@ class foo {
}
}
foo::bar();
+?>
--EXPECT--
Done
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_026.phpt b/Zend/tests/closure_026.phpt
index 50c850e787..0dba62fcb9 100644
--- a/Zend/tests/closure_026.phpt
+++ b/Zend/tests/closure_026.phpt
@@ -4,17 +4,17 @@ Closure 026: Assigning a closure object to an array in $this
<?php
class foo {
- public function __construct() {
- $a =& $this;
+ public function __construct() {
+ $a =& $this;
- $a->a[] = function() {
- return 1;
- };
+ $a->a[] = function() {
+ return 1;
+ };
- var_dump($this);
+ var_dump($this);
- var_dump($this->a[0]());
- }
+ var_dump($this->a[0]());
+ }
}
$x = new foo;
@@ -22,8 +22,8 @@ $x = new foo;
print "--------------\n";
foreach ($x as $b => $c) {
- var_dump($b, $c);
- var_dump($c[0]());
+ var_dump($b, $c);
+ var_dump($c[0]());
}
?>
@@ -47,10 +47,7 @@ array(1) {
["this"]=>
object(foo)#%d (1) {
["a"]=>
- array(1) {
- [0]=>
- *RECURSION*
- }
+ *RECURSION*
}
}
}
diff --git a/Zend/tests/closure_027.phpt b/Zend/tests/closure_027.phpt
index 76754f9fba..7ecfa55e0f 100644
--- a/Zend/tests/closure_027.phpt
+++ b/Zend/tests/closure_027.phpt
@@ -3,8 +3,8 @@ Closure 027: Testing Closure type-hint
--FILE--
<?php
-function test(closure $a) {
- var_dump($a());
+function test(Closure $a) {
+ var_dump($a());
}
@@ -14,9 +14,9 @@ test(function() { });
$a = function($x) use ($y) {};
try {
- test($a);
+ test($a);
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
test(new stdclass);
@@ -27,10 +27,10 @@ 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
+Fatal error: Uncaught TypeError: test(): Argument #1 ($a) must be of type Closure, stdClass given, called in %s:%d
Stack trace:
#0 %s(%d): test(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/closure_028.phpt b/Zend/tests/closure_028.phpt
index c28849f448..2449f2bfdc 100644
--- a/Zend/tests/closure_028.phpt
+++ b/Zend/tests/closure_028.phpt
@@ -4,7 +4,7 @@ Closure 028: Trying to use lambda directly in foreach
<?php
foreach (function(){ return 1; } as $y) {
- var_dump($y);
+ var_dump($y);
}
print "ok\n";
diff --git a/Zend/tests/closure_031.phpt b/Zend/tests/closure_031.phpt
index 042bf8c145..e757f67748 100644
--- a/Zend/tests/closure_031.phpt
+++ b/Zend/tests/closure_031.phpt
@@ -3,15 +3,15 @@ Closure 031: Closure properties with custom error handlers
--FILE--
<?php
function foo($errno, $errstr, $errfile, $errline) {
- echo "Error: $errstr\n";
+ echo "Error: $errstr\n";
}
set_error_handler('foo');
$foo = function() {
};
try {
- var_dump($foo->a);
+ var_dump($foo->a);
} catch (Error $ex) {
- echo "Error: {$ex->getMessage()}\n";
+ echo "Error: {$ex->getMessage()}\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/closure_033.phpt b/Zend/tests/closure_033.phpt
index c83a53898d..720497bd2d 100644
--- a/Zend/tests/closure_033.phpt
+++ b/Zend/tests/closure_033.phpt
@@ -4,15 +4,15 @@ Closure 033: Dynamic closure property and private function
<?php
class Test {
- public $func;
- function __construct() {
- $this->func = function() {
- echo __METHOD__ . "()\n";
- };
- }
- private function func() {
- echo __METHOD__ . "()\n";
- }
+ public $func;
+ function __construct() {
+ $this->func = function() {
+ echo __METHOD__ . "()\n";
+ };
+ }
+ private function func() {
+ echo __METHOD__ . "()\n";
+ }
}
$o = new Test;
@@ -25,7 +25,7 @@ $o->func();
--EXPECTF--
{closure}()
-Fatal error: Uncaught Error: Call to private method Test::func() from context '' in %sclosure_033.php:%d
+Fatal error: Uncaught Error: Call to private method Test::func() from global scope in %s:%d
Stack trace:
#0 {main}
thrown in %sclosure_033.php on line %d
diff --git a/Zend/tests/closure_034.phpt b/Zend/tests/closure_034.phpt
index 8ba276a68a..27981a5c74 100644
--- a/Zend/tests/closure_034.phpt
+++ b/Zend/tests/closure_034.phpt
@@ -7,7 +7,6 @@ $a = function () use(&$a) {};
var_dump($a);
?>
-===DONE===
--EXPECTF--
object(Closure)#%d (1) {
["static"]=>
@@ -16,4 +15,3 @@ object(Closure)#%d (1) {
*RECURSION*
}
}
-===DONE===
diff --git a/Zend/tests/closure_035.phpt b/Zend/tests/closure_035.phpt
index d06d0bb25b..14c11a8219 100644
--- a/Zend/tests/closure_035.phpt
+++ b/Zend/tests/closure_035.phpt
@@ -4,11 +4,11 @@ Testing recursion detection with Closures
<?php
$x = function () use (&$x) {
- $h = function () use ($x) {
- var_dump($x);
- return 1;
- };
- return $h();
+ $h = function () use ($x) {
+ var_dump($x);
+ return 1;
+ };
+ return $h();
};
var_dump($x());
diff --git a/Zend/tests/closure_036.phpt b/Zend/tests/closure_036.phpt
index 9123a1ba47..555a195faa 100644
--- a/Zend/tests/closure_036.phpt
+++ b/Zend/tests/closure_036.phpt
@@ -4,15 +4,15 @@ Closure 036: Rebinding closures, keep calling scope
<?php
class A {
- private $x;
+ private $x;
- public function __construct($v) {
- $this->x = $v;
- }
+ public function __construct($v) {
+ $this->x = $v;
+ }
- public function getIncrementor() {
- return function() { return ++$this->x; };
- }
+ public function getIncrementor() {
+ return function() { return ++$this->x; };
+ }
}
$a = new A(0);
diff --git a/Zend/tests/closure_037.phpt b/Zend/tests/closure_037.phpt
index 1257d6bc7e..ba4cfd6464 100644
--- a/Zend/tests/closure_037.phpt
+++ b/Zend/tests/closure_037.phpt
@@ -3,30 +3,30 @@ Closure 037: self:: and static:: within closures
--FILE--
<?php
class A {
- private $x = 0;
+ private $x = 0;
- function getClosure () {
- return function () {
- $this->x++;
- self::printX();
- self::print42();
- static::print42();
- };
- }
+ function getClosure () {
+ return function () {
+ $this->x++;
+ self::printX();
+ self::print42();
+ static::print42();
+ };
+ }
- function printX () {
- echo $this->x."\n";
- }
+ function printX () {
+ echo $this->x."\n";
+ }
- function print42() {
- echo "42\n";
- }
+ function print42() {
+ echo "42\n";
+ }
}
class B extends A {
- function print42() {
- echo "forty two\n";
- }
+ function print42() {
+ echo "forty two\n";
+ }
}
$a = new A;
diff --git a/Zend/tests/closure_038.phpt b/Zend/tests/closure_038.phpt
index d1ec446c9d..b89ff93c4f 100644
--- a/Zend/tests/closure_038.phpt
+++ b/Zend/tests/closure_038.phpt
@@ -4,22 +4,22 @@ Closure 038: Rebinding closures, change scope, different runtime type
<?php
class A {
- private $x;
+ private $x;
- public function __construct($v) {
- $this->x = $v;
- }
+ public function __construct($v) {
+ $this->x = $v;
+ }
- public function getIncrementor() {
- return function() { return ++$this->x; };
- }
+ public function getIncrementor() {
+ return function() { return ++$this->x; };
+ }
}
class B extends A {
- private $x;
- public function __construct($v) {
- parent::__construct($v);
- $this->x = $v*2;
- }
+ private $x;
+ public function __construct($v) {
+ parent::__construct($v);
+ $this->x = $v*2;
+ }
}
$a = new A(0);
diff --git a/Zend/tests/closure_039.phpt b/Zend/tests/closure_039.phpt
index fa454c38c4..760ad716e5 100644
--- a/Zend/tests/closure_039.phpt
+++ b/Zend/tests/closure_039.phpt
@@ -4,22 +4,22 @@ Closure 039: Rebinding closures, change scope, same runtime type
<?php
class A {
- private $x;
+ private $x;
- public function __construct($v) {
- $this->x = $v;
- }
+ public function __construct($v) {
+ $this->x = $v;
+ }
- public function getIncrementor() {
- return function() { return ++$this->x; };
- }
+ public function getIncrementor() {
+ return function() { return ++$this->x; };
+ }
}
class B extends A {
- private $x;
- public function __construct($v) {
- parent::__construct($v);
- $this->x = $v*2;
- }
+ private $x;
+ public function __construct($v) {
+ parent::__construct($v);
+ $this->x = $v*2;
+ }
}
$a = new B(-5);
diff --git a/Zend/tests/closure_040.phpt b/Zend/tests/closure_040.phpt
index 231ab4081c..436c99939b 100644
--- a/Zend/tests/closure_040.phpt
+++ b/Zend/tests/closure_040.phpt
@@ -4,19 +4,19 @@ Closure 040: Rebinding closures, bad arguments
<?php
class A {
- private $x;
- private static $xs = 10;
-
- public function __construct($v) {
- $this->x = $v;
- }
-
- public function getIncrementor() {
- return function() { return ++$this->x; };
- }
- public function getStaticIncrementor() {
- return static function() { return ++static::$xs; };
- }
+ private $x;
+ private static $xs = 10;
+
+ public function __construct($v) {
+ $this->x = $v;
+ }
+
+ public function getIncrementor() {
+ return function() { return ++$this->x; };
+ }
+ public function getStaticIncrementor() {
+ return static function() { return ++static::$xs; };
+ }
}
$a = new A(20);
@@ -24,22 +24,16 @@ $a = new A(20);
$ca = $a->getIncrementor();
$cas = $a->getStaticIncrementor();
-$ca->bindTo($a, array());
-$ca->bindTo(array(), 'A');
-$ca->bindTo($a, array(), "");
-$ca->bindTo();
+try {
+ $ca->bindTo($a, array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
$cas->bindTo($a, 'A');
?>
--EXPECTF--
-Notice: 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
+Closure::bindTo(): Argument #2 ($newScope) must be of type object|string|null, array given
Warning: Cannot bind an instance to a static closure in %s on line %d
diff --git a/Zend/tests/closure_041.phpt b/Zend/tests/closure_041.phpt
index cfe4f9487f..d709257484 100644
--- a/Zend/tests/closure_041.phpt
+++ b/Zend/tests/closure_041.phpt
@@ -8,29 +8,29 @@ Closure 041: Rebinding: preservation of previous scope when not given as arg unl
* to having a bound instance. */
$staticUnscoped = static function () {
- echo "scoped to A: "; var_dump(isset(A::$priv));
- echo "bound: ", isset($this)?get_class($this):"no";
+ echo "scoped to A: "; var_dump(isset(A::$priv));
+ echo "bound: ", isset($this)?get_class($this):"no";
};
$nonstaticUnscoped = function () {
- echo "scoped to A: "; var_dump(isset(A::$priv));
- echo "bound: ", isset($this)?get_class($this):"no";
+ echo "scoped to A: "; var_dump(isset(A::$priv));
+ echo "bound: ", isset($this)?get_class($this):"no";
};
class A {
- private static $priv = 7;
- function getClosure() {
- return function () {
- echo "scoped to A: "; var_dump(isset(A::$priv));
- echo "bound: ", isset($this)?get_class($this):"no";
- };
- }
- function getStaticClosure() {
- return static function () {
- echo "scoped to A: "; var_dump(isset(A::$priv));
- echo "bound: ", isset($this)?get_class($this):"no";
- };
- }
+ private static $priv = 7;
+ function getClosure() {
+ return function () {
+ echo "scoped to A: "; var_dump(isset(A::$priv));
+ echo "bound: ", isset($this)?get_class($this):"no";
+ };
+ }
+ function getStaticClosure() {
+ return static function () {
+ echo "scoped to A: "; var_dump(isset(A::$priv));
+ echo "bound: ", isset($this)?get_class($this):"no";
+ };
+ }
}
class B extends A {}
@@ -48,9 +48,7 @@ echo "After binding, no instance", "\n";
$d = $staticUnscoped->bindTo(null); $d(); echo "\n";
$d = $nonstaticUnscoped->bindTo(null); $d(); echo "\n";
$d = $staticScoped->bindTo(null); $d(); echo "\n";
-$d = $nonstaticScoped->bindTo(null); $d(); echo "\n";
-// $d is still non-static
-$d->bindTo($d);
+$d = $nonstaticScoped->bindTo(null); var_dump($d); echo "\n";
echo "After binding, with same-class instance for the bound ones", "\n";
$d = $staticUnscoped->bindTo(new A);
@@ -63,6 +61,7 @@ $d = $nonstaticUnscoped->bindTo(new B); $d(); echo " (should be scoped to dummy
$d = $nonstaticScoped->bindTo(new B); $d(); echo "\n";
echo "Done.\n";
+?>
--EXPECTF--
Before binding
scoped to A: bool(false)
@@ -81,9 +80,9 @@ bound: no
scoped to A: bool(true)
bound: no
-Deprecated: Unbinding $this of closure is deprecated in %s on line %d
-scoped to A: bool(true)
-bound: no
+Warning: Cannot unbind $this of closure using $this in %s on line %d
+NULL
+
After binding, with same-class instance for the bound ones
Warning: Cannot bind an instance to a static closure in %s on line %d
diff --git a/Zend/tests/closure_043.phpt b/Zend/tests/closure_043.phpt
index 2390aa153b..bfcd37b38e 100644
--- a/Zend/tests/closure_043.phpt
+++ b/Zend/tests/closure_043.phpt
@@ -9,10 +9,10 @@ Closure 043: Scope/bounding combination invariants; static closures
$staticUnscoped = static function () { var_dump(isset(A::$priv)); var_dump(isset($this)); };
class A {
- private static $priv = 7;
- static function getStaticClosure() {
- return static function() { var_dump(isset(A::$priv)); var_dump(isset($this)); };
- }
+ private static $priv = 7;
+ static function getStaticClosure() {
+ return static function() { var_dump(isset(A::$priv)); var_dump(isset($this)); };
+ }
}
$staticScoped = A::getStaticClosure();
@@ -38,6 +38,7 @@ $d = $staticUnscoped->bindTo(new A, 'A');
$d = $staticScoped->bindTo(new A, 'A');
echo "Done.\n";
+?>
--EXPECTF--
Before binding
bool(false)
diff --git a/Zend/tests/closure_044.phpt b/Zend/tests/closure_044.phpt
index 225d7540d2..544ad8bee8 100644
--- a/Zend/tests/closure_044.phpt
+++ b/Zend/tests/closure_044.phpt
@@ -8,10 +8,10 @@ Closure 044: Scope/bounding combination invariants; non static closures
$nonstaticUnscoped = function () { var_dump(isset(A::$priv)); var_dump(isset($this)); };
class A {
- private static $priv = 7;
- function getClosure() {
- return function() { var_dump(isset(A::$priv)); var_dump(isset($this)); };
- }
+ private static $priv = 7;
+ function getClosure() {
+ return function() { var_dump(isset(A::$priv)); var_dump(isset($this)); };
+ }
}
$a = new A();
@@ -23,7 +23,7 @@ $nonstaticScoped(); echo "\n";
echo "After binding, null scope, no instance", "\n";
$d = $nonstaticUnscoped->bindTo(null, null); $d(); echo "\n";
-$d = $nonstaticScoped->bindTo(null, null); $d(); echo "\n";
+$d = $nonstaticScoped->bindTo(null, null); var_dump($d); echo "\n";
echo "After binding, null scope, with instance", "\n";
$d = $nonstaticUnscoped->bindTo(new A, null); $d(); echo "\n";
@@ -31,13 +31,14 @@ $d = $nonstaticScoped->bindTo(new A, null); $d(); echo "\n";
echo "After binding, with scope, no instance", "\n";
$d = $nonstaticUnscoped->bindTo(null, 'A'); $d(); echo "\n";
-$d = $nonstaticScoped->bindTo(null, 'A'); $d(); echo "\n";
+$d = $nonstaticScoped->bindTo(null, 'A'); var_dump($d); echo "\n";
echo "After binding, with scope, with instance", "\n";
$d = $nonstaticUnscoped->bindTo(new A, 'A'); $d(); echo "\n";
$d = $nonstaticScoped->bindTo(new A, 'A'); $d(); echo "\n";
echo "Done.\n";
+?>
--EXPECTF--
Before binding
bool(false)
@@ -51,9 +52,8 @@ bool(false)
bool(false)
-Deprecated: Unbinding $this of closure is deprecated in %s on line %d
-bool(false)
-bool(false)
+Warning: Cannot unbind $this of closure using $this in %s on line %d
+NULL
After binding, null scope, with instance
bool(false)
@@ -67,9 +67,8 @@ bool(true)
bool(false)
-Deprecated: Unbinding $this of closure is deprecated in %s on line %d
-bool(true)
-bool(false)
+Warning: Cannot unbind $this of closure using $this in %s on line %d
+NULL
After binding, with scope, with instance
bool(true)
diff --git a/Zend/tests/closure_045.phpt b/Zend/tests/closure_045.phpt
index 2b99476678..6ffce8342e 100644
--- a/Zend/tests/closure_045.phpt
+++ b/Zend/tests/closure_045.phpt
@@ -13,5 +13,6 @@ $a = A::foo();
$a->bindTo(new A);
echo "Done.\n";
+?>
--EXPECT--
Done.
diff --git a/Zend/tests/closure_046.phpt b/Zend/tests/closure_046.phpt
index e10cc1b57e..9dbcba5ce5 100644
--- a/Zend/tests/closure_046.phpt
+++ b/Zend/tests/closure_046.phpt
@@ -10,10 +10,10 @@ Closure 046: Rebinding: preservation of previous scope when "static" given as sc
$nonstaticUnscoped = function () { var_dump(isset(A::$priv)); var_dump(isset($this)); };
class A {
- private static $priv = 7;
- function getClosure() {
- return function() { var_dump(isset(A::$priv)); var_dump(isset($this)); };
- }
+ private static $priv = 7;
+ function getClosure() {
+ return function() { var_dump(isset(A::$priv)); var_dump(isset($this)); };
+ }
}
class B extends A {}
@@ -26,9 +26,7 @@ $nonstaticScoped(); echo "\n";
echo "After binding, no instance", "\n";
$d = $nonstaticUnscoped->bindTo(null, "static"); $d(); echo "\n";
-$d = $nonstaticScoped->bindTo(null, "static"); $d(); echo "\n";
-// $d is still non-static
-$d->bindTo($d);
+$d = $nonstaticScoped->bindTo(null, "static"); var_dump($d); echo "\n";
echo "After binding, with same-class instance for the bound one", "\n";
$d = $nonstaticUnscoped->bindTo(new A, "static"); $d(); echo "\n";
@@ -38,6 +36,7 @@ echo "After binding, with different instance for the bound one", "\n";
$d = $nonstaticScoped->bindTo(new B, "static"); $d(); echo "\n";
echo "Done.\n";
+?>
--EXPECTF--
Before binding
bool(false)
@@ -51,9 +50,8 @@ bool(false)
bool(false)
-Deprecated: Unbinding $this of closure is deprecated in %s on line %d
-bool(true)
-bool(false)
+Warning: Cannot unbind $this of closure using $this in %s on line %d
+NULL
After binding, with same-class instance for the bound one
bool(false)
diff --git a/Zend/tests/closure_047.phpt b/Zend/tests/closure_047.phpt
index 736793448d..60d7916198 100644
--- a/Zend/tests/closure_047.phpt
+++ b/Zend/tests/closure_047.phpt
@@ -5,13 +5,13 @@ Closure 047: Use in preg_replace_callback() using variables by reference
function replace_variables($text, $params) {
- preg_replace_callback( '/(\?)/', function($matches) use (&$params, &$text) {
+ preg_replace_callback( '/(\?)/', function($matches) use (&$params, &$text) {
- $text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 );
+ $text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 );
- }, $text );
+ }, $text );
- return $text;
+ return $text;
}
echo replace_variables('a=?', array('0')) . "\n";
diff --git a/Zend/tests/closure_048.phpt b/Zend/tests/closure_048.phpt
index 47781641a8..8365109934 100644
--- a/Zend/tests/closure_048.phpt
+++ b/Zend/tests/closure_048.phpt
@@ -5,13 +5,13 @@ Closure 048: Use in preg_replace_callback() using variables by reference
function replace_variables($text, $params) {
- $c = function($matches) use (&$params, &$text) {
- $text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 );
- };
+ $c = function($matches) use (&$params, &$text) {
+ $text = preg_replace( '/(\?)/', array_shift( $params ), $text, 1 );
+ };
- preg_replace_callback( '/(\?)/', $c, $text );
+ preg_replace_callback( '/(\?)/', $c, $text );
- return $text;
+ return $text;
}
echo replace_variables('a=?', array('0')) . "\n";
diff --git a/Zend/tests/closure_049.phpt b/Zend/tests/closure_049.phpt
index c5ed917f16..80e56e32c9 100644
--- a/Zend/tests/closure_049.phpt
+++ b/Zend/tests/closure_049.phpt
@@ -17,5 +17,6 @@ class B extends A {}
$b = new B;
var_dump($b->foo());
+?>
--EXPECT--
string(1) "B"
diff --git a/Zend/tests/closure_050.phpt b/Zend/tests/closure_050.phpt
index 1ab0c3fa58..f9339cd966 100644
--- a/Zend/tests/closure_050.phpt
+++ b/Zend/tests/closure_050.phpt
@@ -16,5 +16,6 @@ class B extends A {}
$b = new B;
var_dump($b->foo());
+?>
--EXPECT--
string(1) "B"
diff --git a/Zend/tests/closure_051.phpt b/Zend/tests/closure_051.phpt
index ab514123c0..95180e95f4 100644
--- a/Zend/tests/closure_051.phpt
+++ b/Zend/tests/closure_051.phpt
@@ -15,5 +15,6 @@ class A {
class B extends A {}
var_dump(B::foo());
+?>
--EXPECT--
string(1) "B"
diff --git a/Zend/tests/closure_052.phpt b/Zend/tests/closure_052.phpt
index 5550cc92dc..79397edb39 100644
--- a/Zend/tests/closure_052.phpt
+++ b/Zend/tests/closure_052.phpt
@@ -15,5 +15,6 @@ class A {
class B extends A {}
var_dump(B::foo());
+?>
--EXPECT--
string(1) "B"
diff --git a/Zend/tests/closure_053.phpt b/Zend/tests/closure_053.phpt
index 65c65ae08a..d8c7044927 100644
--- a/Zend/tests/closure_053.phpt
+++ b/Zend/tests/closure_053.phpt
@@ -16,5 +16,6 @@ class B extends A {}
$b = new B;
var_dump($b->foo());
+?>
--EXPECT--
string(1) "A"
diff --git a/Zend/tests/closure_054.phpt b/Zend/tests/closure_054.phpt
index 87c46d7a19..f81e6c96d5 100644
--- a/Zend/tests/closure_054.phpt
+++ b/Zend/tests/closure_054.phpt
@@ -16,5 +16,6 @@ class B extends A {}
$b = new B;
var_dump($b->foo());
+?>
--EXPECT--
string(1) "A"
diff --git a/Zend/tests/closure_055.phpt b/Zend/tests/closure_055.phpt
index 2dc1d47103..f903b487c5 100644
--- a/Zend/tests/closure_055.phpt
+++ b/Zend/tests/closure_055.phpt
@@ -15,5 +15,6 @@ class A {
class B extends A {}
var_dump(B::foo());
+?>
--EXPECT--
string(1) "A"
diff --git a/Zend/tests/closure_056.phpt b/Zend/tests/closure_056.phpt
index d1fa848ee6..b032135139 100644
--- a/Zend/tests/closure_056.phpt
+++ b/Zend/tests/closure_056.phpt
@@ -15,5 +15,6 @@ class A {
class B extends A {}
var_dump(B::foo());
+?>
--EXPECT--
string(1) "A"
diff --git a/Zend/tests/closure_057.phpt b/Zend/tests/closure_057.phpt
index f0062244d2..db998c5184 100644
--- a/Zend/tests/closure_057.phpt
+++ b/Zend/tests/closure_057.phpt
@@ -6,12 +6,12 @@ class A {
}
function getfunc() {
- $b = function() {
- $a = function() {
- };
- $a();
- };
- return $b->bindTo(new A());
+ $b = function() {
+ $a = function() {
+ };
+ $a();
+ };
+ return $b->bindTo(new A());
}
call_user_func(getfunc());
diff --git a/Zend/tests/closure_058.phpt b/Zend/tests/closure_058.phpt
index 128661f4fc..5880492201 100644
--- a/Zend/tests/closure_058.phpt
+++ b/Zend/tests/closure_058.phpt
@@ -3,12 +3,12 @@ Closure 058: Closure scope and object
--FILE--
<?php
class A {
- static function foo() {
- return function () {var_dump(get_class(),get_called_class());};
- }
- function bar() {
- return function () {var_dump(get_class(),get_called_class(),$this);};
- }
+ static function foo() {
+ return function () {var_dump(get_class(),get_called_class());};
+ }
+ function bar() {
+ return function () {var_dump(get_class(),get_called_class(),$this);};
+ }
}
$z = "call_user_func";
@@ -30,6 +30,7 @@ $c = array($b,"__invoke");
$c();
call_user_func(array($b,"__invoke"));
$z(array($b,"__invoke"));
+?>
--EXPECT--
string(1) "A"
string(1) "A"
diff --git a/Zend/tests/closure_059.phpt b/Zend/tests/closure_059.phpt
index 299d8f5d9d..9ec04d02ae 100644
--- a/Zend/tests/closure_059.phpt
+++ b/Zend/tests/closure_059.phpt
@@ -18,21 +18,22 @@ $f->__invoke($a);
call_user_func(array($f,"__invoke"), $a);
try {
- $f($b);
+ $f($b);
} catch (Error $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- $f->__invoke($b);
+ $f->__invoke($b);
} catch (Error $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- call_user_func(array($f,"__invoke"), $b);
+ call_user_func(array($f,"__invoke"), $b);
} catch (Error $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
+?>
--EXPECTF--
-Exception: Argument 1 passed to {closure}() must be an instance of A, instance of B %s
-Exception: Argument 1 passed to {closure}() must be an instance of A, instance of B %s
-Exception: Argument 1 passed to {closure}() must be an instance of A, instance of B %s
+Exception: {closure}(): Argument #1 ($a) must be of type A, B given, called in %s on line %d
+Exception: {closure}(): Argument #1 ($a) must be of type A, B given
+Exception: {closure}(): Argument #1 ($a) must be of type A, B given
diff --git a/Zend/tests/closure_060.phpt b/Zend/tests/closure_060.phpt
index f03160dab9..9762318469 100644
--- a/Zend/tests/closure_060.phpt
+++ b/Zend/tests/closure_060.phpt
@@ -4,13 +4,13 @@ runtime cache must be invalidated for Closure::call()
<?php
class A {
- private static $priv = 7;
+ private static $priv = 7;
- static function get() {
- return function() {
- var_dump(isset(A::$priv));
- };
- }
+ static function get() {
+ return function() {
+ var_dump(isset(A::$priv));
+ };
+ }
}
$closure = A::get();
diff --git a/Zend/tests/closure_061.phpt b/Zend/tests/closure_061.phpt
index 41863fd0c0..240f22e036 100644
--- a/Zend/tests/closure_061.phpt
+++ b/Zend/tests/closure_061.phpt
@@ -175,9 +175,7 @@ Cannot rebind scope of closure created from method
-------------------
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 from method
diff --git a/Zend/tests/closure_062.phpt b/Zend/tests/closure_062.phpt
index d56b4f0663..b8c0a981be 100644
--- a/Zend/tests/closure_062.phpt
+++ b/Zend/tests/closure_062.phpt
@@ -48,7 +48,7 @@ Test::staticMethod();
--EXPECTF--
instance scoped, non-static, $this used
-Deprecated: Unbinding $this of closure is deprecated in %s on line %d
+Warning: Cannot unbind $this of closure using $this in %s on line %d
instance scoped, static, $this used
instance scoped, non-static, $this not used
static scoped, non-static, $this used
diff --git a/Zend/tests/closure_bug66622.phpt b/Zend/tests/closure_bug66622.phpt
index 44bbcbaa8d..2a02198351 100644
--- a/Zend/tests/closure_bug66622.phpt
+++ b/Zend/tests/closure_bug66622.phpt
@@ -28,6 +28,7 @@ function test() {
B::baz();
}
test();
+?>
--EXPECT--
B vs B
B vs B
diff --git a/Zend/tests/closure_call_leak_with_exception.phpt b/Zend/tests/closure_call_leak_with_exception.phpt
index f6545ee520..420dd9a735 100644
--- a/Zend/tests/closure_call_leak_with_exception.phpt
+++ b/Zend/tests/closure_call_leak_with_exception.phpt
@@ -4,8 +4,8 @@ Closure must not leak during a dynamic call interrupted by an exception
<?php
(function() {
- $closure = function($foo) { var_dump($foo); };
- $closure(yield);
+ $closure = function($foo) { var_dump($foo); };
+ $closure(yield);
})()->valid(); // start
?>
diff --git a/Zend/tests/closure_invoke_ref_warning.phpt b/Zend/tests/closure_invoke_ref_warning.phpt
new file mode 100644
index 0000000000..08eefd3fb2
--- /dev/null
+++ b/Zend/tests/closure_invoke_ref_warning.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Argument name for Closure::__invoke via call_user_func reference warning
+--FILE--
+<?php
+
+$test = function(&$arg) {};
+call_user_func([$test, '__invoke'], null);
+
+?>
+--EXPECTF--
+Warning: Closure::__invoke(): Argument #1 ($arg) must be passed by reference, value given in %s on line %d
+
+Warning: {closure}(): Argument #1 ($arg) must be passed by reference, value given in %s on line %d
diff --git a/Zend/tests/closure_use_trailing_comma.phpt b/Zend/tests/closure_use_trailing_comma.phpt
new file mode 100644
index 0000000000..7bf6e5ce88
--- /dev/null
+++ b/Zend/tests/closure_use_trailing_comma.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Closure use list can have trailing commas
+--FILE--
+<?php
+
+$b = 'test';
+$fn = function () use (
+ $b,
+ &$a,
+) {
+ $a = $b;
+};
+$fn();
+echo "$a\n";
+?>
+--EXPECT--
+test
diff --git a/Zend/tests/closures/closure_from_callable.inc b/Zend/tests/closures/closure_from_callable.inc
index 22a1fa9930..d691ef1757 100644
--- a/Zend/tests/closures/closure_from_callable.inc
+++ b/Zend/tests/closures/closure_from_callable.inc
@@ -2,186 +2,186 @@
function bar($param1)
{
- return $param1;
+ return $param1;
}
$closure = function($param1) {
- return $param1;
+ return $param1;
};
function test($fn)
{
- static $count = 0;
- $input = "foo".$count;
- $count++;
+ static $count = 0;
+ $input = "foo".$count;
+ $count++;
- $output = $fn($input);
- return $input === $output;
+ $output = $fn($input);
+ return $input === $output;
}
class Foo
{
- public static function publicStaticFunction($param1)
- {
- return $param1;
- }
-
- private static function privateStaticFunction($param1)
- {
- return $param1;
- }
-
- protected static function protectedStaticFunction($param1)
- {
- return $param1;
- }
-
- private function privateInstanceFunc($param1)
- {
- return $param1;
- }
-
- protected function protectedInstanceFunc($param1)
- {
- return $param1;
- }
-
-
- public function publicInstanceFunc($param1)
- {
- return $param1;
- }
-
- public function closePrivateValid()
- {
- return Closure::fromCallable([$this, 'privateInstanceFunc']);
- }
-
- public function closePrivateStatic()
- {
- return Closure::fromCallable([__CLASS__, 'privateStaticFunction']);
- }
-
- public function bar($param1)
- {
- echo "this is bar\n";
- }
-
- public function getCallable()
- {
- return Closure::fromCallable([$this, 'publicInstanceFunc']);
- }
-
- public function getSelfPublicInstance()
- {
- return Closure::fromCallable([$this, 'publicInstanceFunc']);
- }
-
- public function getSelfColonPublicInstanceMethod()
- {
- return Closure::fromCallable('self::publicInstanceFunc');
- }
+ public static function publicStaticFunction($param1)
+ {
+ return $param1;
+ }
+
+ private static function privateStaticFunction($param1)
+ {
+ return $param1;
+ }
+
+ protected static function protectedStaticFunction($param1)
+ {
+ return $param1;
+ }
+
+ private function privateInstanceFunc($param1)
+ {
+ return $param1;
+ }
+
+ protected function protectedInstanceFunc($param1)
+ {
+ return $param1;
+ }
+
+
+ public function publicInstanceFunc($param1)
+ {
+ return $param1;
+ }
+
+ public function closePrivateValid()
+ {
+ return Closure::fromCallable([$this, 'privateInstanceFunc']);
+ }
+
+ public function closePrivateStatic()
+ {
+ return Closure::fromCallable([__CLASS__, 'privateStaticFunction']);
+ }
+
+ public function bar($param1)
+ {
+ echo "this is bar\n";
+ }
+
+ public function getCallable()
+ {
+ return Closure::fromCallable([$this, 'publicInstanceFunc']);
+ }
+
+ public function getSelfPublicInstance()
+ {
+ return Closure::fromCallable([$this, 'publicInstanceFunc']);
+ }
+
+ public function getSelfColonPublicInstanceMethod()
+ {
+ return Closure::fromCallable('self::publicInstanceFunc');
+ }
}
class SubFoo extends Foo {
- public function closePrivateStaticInvalid()
- {
- return Closure::fromCallable([__CLASS__, 'privateStaticFunction']);
- }
+ public function closePrivateStaticInvalid()
+ {
+ return Closure::fromCallable([__CLASS__, 'privateStaticFunction']);
+ }
- public function closePrivateInvalid()
- {
- return Closure::fromCallable([$this, 'privateInstanceFunc']);
- }
+ public function closePrivateInvalid()
+ {
+ return Closure::fromCallable([$this, 'privateInstanceFunc']);
+ }
- public function closeProtectedStaticMethod()
- {
- return Closure::fromCallable([__CLASS__, 'protectedStaticFunction']);
- }
+ public function closeProtectedStaticMethod()
+ {
+ return Closure::fromCallable([__CLASS__, 'protectedStaticFunction']);
+ }
- public function closeProtectedValid()
- {
- return Closure::fromCallable([$this, 'protectedInstanceFunc']);
- }
+ public function closeProtectedValid()
+ {
+ return Closure::fromCallable([$this, 'protectedInstanceFunc']);
+ }
- public function getParentPublicInstanceMethod()
- {
- return Closure::fromCallable('parent::publicInstanceFunc');
- }
+ public function getParentPublicInstanceMethod()
+ {
+ return Closure::fromCallable('parent::publicInstanceFunc');
+ }
- public function getSelfColonParentPublicInstanceMethod()
- {
- return Closure::fromCallable('self::publicInstanceFunc');
- }
+ public function getSelfColonParentPublicInstanceMethod()
+ {
+ return Closure::fromCallable('self::publicInstanceFunc');
+ }
- public function getSelfColonParentProtectedInstanceMethod()
- {
- return Closure::fromCallable('self::protectedInstanceFunc');
- }
+ public function getSelfColonParentProtectedInstanceMethod()
+ {
+ return Closure::fromCallable('self::protectedInstanceFunc');
+ }
- public function getSelfColonParentPrivateInstanceMethod()
- {
- return Closure::fromCallable('self::privateInstanceFunc');
- }
+ public function getSelfColonParentPrivateInstanceMethod()
+ {
+ return Closure::fromCallable('self::privateInstanceFunc');
+ }
}
class MagicCall
{
- public function __call($name, $arguments)
- {
- $info = ['__call'];
- $info[] = $name;
- $info = array_merge($info, $arguments);
- return implode(',', $info);
- }
-
- public static function __callStatic($name, $arguments)
- {
- $info = ['__callStatic'];
- $info[] = $name;
- $info = array_merge($info, $arguments);
- return implode(',', $info);
- }
+ public function __call($name, $arguments)
+ {
+ $info = ['__call'];
+ $info[] = $name;
+ $info = array_merge($info, $arguments);
+ return implode(',', $info);
+ }
+
+ public static function __callStatic($name, $arguments)
+ {
+ $info = ['__callStatic'];
+ $info[] = $name;
+ $info = array_merge($info, $arguments);
+ return implode(',', $info);
+ }
}
-class PublicInvokable
+class PublicInvocable
{
- public function __invoke($param1)
- {
- return $param1;
- }
+ public function __invoke($param1)
+ {
+ return $param1;
+ }
}
function functionAccessProtected()
{
- $foo = new Foo;
+ $foo = new Foo;
- return Closure::fromCallable([$foo, 'protectedStaticFunction']);
+ return Closure::fromCallable([$foo, 'protectedStaticFunction']);
}
function functionAccessPrivate()
{
- $foo = new Foo;
+ $foo = new Foo;
- return Closure::fromCallable([$foo, 'privateStaticFunction']);
+ return Closure::fromCallable([$foo, 'privateStaticFunction']);
}
function functionAccessMethodDoesntExist()
{
- $foo = new Foo;
+ $foo = new Foo;
- return Closure::fromCallable([$foo, 'thisDoesNotExist']);
+ return Closure::fromCallable([$foo, 'thisDoesNotExist']);
}
?>
diff --git a/Zend/tests/closures/closure_from_callable_basic.phpt b/Zend/tests/closures/closure_from_callable_basic.phpt
index 0aacaf2ff5..88a27c7e70 100644
--- a/Zend/tests/closures/closure_from_callable_basic.phpt
+++ b/Zend/tests/closures/closure_from_callable_basic.phpt
@@ -37,8 +37,8 @@ echo 'Closure is already a closure';
$fn = Closure::fromCallable($closure);
echo $fn(" OK".PHP_EOL);
-echo 'Class with public invokable';
-$fn = Closure::fromCallable(new PublicInvokable);
+echo 'Class with public invocable';
+$fn = Closure::fromCallable(new PublicInvocable);
echo $fn(" OK".PHP_EOL);
echo "Instance return private method as callable";
@@ -81,7 +81,7 @@ $foo = new SubFoo;
$fn = $foo->getSelfColonParentPublicInstanceMethod();
echo $fn(" OK".PHP_EOL);
-echo 'Access proteced instance method of parent object through "self::" to parent method';
+echo 'Access protected instance method of parent object through "self::" to parent method';
$foo = new SubFoo;
$fn = $foo->getSelfColonParentProtectedInstanceMethod();
echo $fn(" OK".PHP_EOL);
@@ -96,7 +96,6 @@ echo $fn(" OK".PHP_EOL);
?>
-===DONE===
--EXPECT--
Access public static function OK
Access public static function with different case OK
@@ -106,7 +105,7 @@ Access public instance method of parent object through parent:: OK
Function that exists OK
Function that exists with different spelling OK
Closure is already a closure OK
-Class with public invokable OK
+Class with public invocable OK
Instance return private method as callable OK
Instance return private static method as callable OK
Instance return protected static method as callable OK
@@ -115,7 +114,6 @@ Subclass closure over parent class static protected method OK
Access public instance method of parent object through "parent::" OK
Access public instance method of self object through "self::" OK
Access public instance method of parent object through "self::" to parent method OK
-Access proteced instance method of parent object through "self::" to parent method OK
+Access protected instance method of parent object through "self::" to parent method OK
MagicCall __call instance method __call,nonExistentMethod, OK
MagicCall __callStatic static method __callStatic,nonExistentMethod, OK
-===DONE===
diff --git a/Zend/tests/closures/closure_from_callable_error.phpt b/Zend/tests/closures/closure_from_callable_error.phpt
index c6e4a7e0bb..5d1e078c1e 100644
--- a/Zend/tests/closures/closure_from_callable_error.phpt
+++ b/Zend/tests/closures/closure_from_callable_error.phpt
@@ -7,193 +7,192 @@ include('closure_from_callable.inc');
echo 'Cannot access privateInstance method statically'."\n";
try {
- $fn = Closure::fromCallable(['Foo', 'privateInstanceFunc']);
- echo "Test failed to fail and return was : ".var_export($fn, true)."\n";
+ $fn = Closure::fromCallable(['Foo', 'privateInstanceFunc']);
+ echo "Test failed to fail and return was : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Cannot access privateInstance method statically with colon scheme'."\n";
try {
- $fn = Closure::fromCallable('Foo::privateInstanceFunc');
- echo "Test failed to fail and return was : ".var_export($fn, true)."\n";
+ $fn = Closure::fromCallable('Foo::privateInstanceFunc');
+ echo "Test failed to fail and return was : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Cannot access privateInstance method'."\n";
try {
- $fn = Closure::fromCallable([new Foo, 'privateInstanceFunc']);
- echo "Test failed to fail and return was : ".var_export($fn, true)."\n";
+ $fn = Closure::fromCallable([new Foo, 'privateInstanceFunc']);
+ echo "Test failed to fail and return was : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'SubClass cannot access private instance method'."\n";
try {
- $fn = Closure::fromCallable([new SubFoo, 'privateInstanceFunc']);
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $fn = Closure::fromCallable([new SubFoo, 'privateInstanceFunc']);
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Cannot access private static function of instance'."\n";
try {
- $fn = Closure::fromCallable([new Foo, 'privateStaticFunction']);
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $fn = Closure::fromCallable([new Foo, 'privateStaticFunction']);
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Cannot access private static method statically'."\n";
try {
- $fn = Closure::fromCallable(['Foo', 'privateStaticFunction']);
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $fn = Closure::fromCallable(['Foo', 'privateStaticFunction']);
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Cannot access private static method statically with colon scheme'."\n";
try {
- $fn = Closure::fromCallable('Foo::privateStaticFunction');
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $fn = Closure::fromCallable('Foo::privateStaticFunction');
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Non-existent method should fail'."\n";
try {
- $fn = Closure::fromCallable('Foo::nonExistentFunction');
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $fn = Closure::fromCallable('Foo::nonExistentFunction');
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Non-existent class should fail'."\n";
try {
- $fn = Closure::fromCallable(['NonExistentClass', 'foo']);
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $fn = Closure::fromCallable(['NonExistentClass', 'foo']);
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Non-existent function should fail'."\n";
try {
- $fn = Closure::fromCallable('thisDoesNotExist');
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $fn = Closure::fromCallable('thisDoesNotExist');
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Subclass cannot closure over parent private instance method'."\n";
try {
- $subFoo = new SubFoo;
- $fn = $subFoo->closePrivateInvalid();
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $subFoo = new SubFoo;
+ $fn = $subFoo->closePrivateInvalid();
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Subclass cannot closure over parant private static method'."\n";
try {
- $subFoo = new SubFoo;
- $fn = $subFoo->closePrivateStaticInvalid();
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $subFoo = new SubFoo;
+ $fn = $subFoo->closePrivateStaticInvalid();
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Function scope cannot closure over protected instance method'."\n";
try {
- $fn = functionAccessProtected();
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $fn = functionAccessProtected();
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Function scope cannot closure over private instance method'."\n";
try {
- $fn = functionAccessPrivate();
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $fn = functionAccessPrivate();
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo 'Access private instance method of parent object through "self::" to parent method'."\n";
try {
- $foo = new SubFoo;
- $fn = $foo->getSelfColonParentPrivateInstanceMethod();
- echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
+ $foo = new SubFoo;
+ $fn = $foo->getSelfColonParentPrivateInstanceMethod();
+ echo "Test failed to fail, closure is : ".var_export($fn, true)."\n";
}
catch (\TypeError $te) {
- //This is the expected outcome.
+ //This is the expected outcome.
}
catch (\Throwable $t) {
- echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
+ echo "Wrong exception type thrown: ".get_class($t)." : ".$t->getMessage()."\n";
}
echo "OK\n";
?>
-===DONE===
--EXPECT--
Cannot access privateInstance method statically
Cannot access privateInstance method statically with colon scheme
@@ -211,4 +210,3 @@ Function scope cannot closure over protected instance method
Function scope cannot closure over private instance method
Access private instance method of parent object through "self::" to parent method
OK
-===DONE===
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/closures/closure_from_callable_reflection.phpt b/Zend/tests/closures/closure_from_callable_reflection.phpt
index 111115a44a..4cd8504266 100644
--- a/Zend/tests/closures/closure_from_callable_reflection.phpt
+++ b/Zend/tests/closures/closure_from_callable_reflection.phpt
@@ -4,8 +4,8 @@ Testing Closure::fromCallable() functionality: Reflection
<?php
class Bar {
- public static function staticMethod(Bar $bar, int $int, $none) {}
- public static function instanceMethod(Bar $bar, int $int, $none) {}
+ public static function staticMethod(Bar $bar, int $int, $none) {}
+ public static function instanceMethod(Bar $bar, int $int, $none) {}
}
function foo(Bar $bar, int $int, $none) {
@@ -16,22 +16,22 @@ $fn = function (Bar $bar, int $x, $none) {};
$bar = new Bar();
$callables = [
- 'foo',
- $fn,
- 'Bar::staticMethod',
- [$bar, 'instanceMethod']
+ 'foo',
+ $fn,
+ 'Bar::staticMethod',
+ [$bar, 'instanceMethod']
];
foreach ($callables as $callable) {
- $closure = Closure::fromCallable($callable);
- $refl = new ReflectionFunction($closure);
- foreach ($refl->getParameters() as $param) {
- if ($param->hasType()) {
- $type = $param->getType();
- echo $type->getName() . "\n";
- }
- }
+ $closure = Closure::fromCallable($callable);
+ $refl = new ReflectionFunction($closure);
+ foreach ($refl->getParameters() as $param) {
+ if ($param->hasType()) {
+ $type = $param->getType();
+ echo $type->getName() . "\n";
+ }
+ }
}
?>
diff --git a/Zend/tests/closures/closure_instantiate.phpt b/Zend/tests/closures/closure_instantiate.phpt
index fa936a219b..de3b866cb8 100644
--- a/Zend/tests/closures/closure_instantiate.phpt
+++ b/Zend/tests/closures/closure_instantiate.phpt
@@ -12,10 +12,10 @@ try {
// Instantiating a closure is an error, not an exception, so we shouldn't see this
echo 'EXCEPTION: ', $e->getMessage();
} catch (Throwable $e) {
- // This is the mesage that we should see for a caught error
+ // This is the message that we should see for a caught error
echo 'ERROR: ', $e->getMessage();
}
?>
--EXPECT--
-ERROR: Instantiation of 'Closure' is not allowed
+ERROR: Instantiation of class Closure is not allowed
diff --git a/Zend/tests/compare_001.phpt b/Zend/tests/compare_001.phpt
index d9f3f080bc..adab47f768 100644
--- a/Zend/tests/compare_001.phpt
+++ b/Zend/tests/compare_001.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var == $a[$i]) ? " == " : " != ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var == $a[$i]) ? " == " : " != ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
@@ -70,7 +70,7 @@ string(0) "" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(0) "" == string(0) ""
string(0) "" != int(1)
string(0) "" != float(2.5)
-string(0) "" == int(0)
+string(0) "" != int(0)
string(0) "" != string(6) "string"
string(0) "" != string(3) "123"
string(0) "" != string(3) "2.5"
@@ -130,11 +130,11 @@ float(2.5) != array(0) {}
float(2.5) != int(-2147483648)
float(2.5) != string(11) "-2147483648"
int(0) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(0) == string(0) ""
+int(0) != string(0) ""
int(0) != int(1)
int(0) != float(2.5)
int(0) == int(0)
-int(0) == string(6) "string"
+int(0) != string(6) "string"
int(0) != string(3) "123"
int(0) != string(3) "2.5"
int(0) == NULL
@@ -156,7 +156,7 @@ string(6) "string" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(6) "string" != string(0) ""
string(6) "string" != int(1)
string(6) "string" != float(2.5)
-string(6) "string" == int(0)
+string(6) "string" != int(0)
string(6) "string" == string(6) "string"
string(6) "string" != string(3) "123"
string(6) "string" != string(3) "2.5"
diff --git a/Zend/tests/compare_001_64bit.phpt b/Zend/tests/compare_001_64bit.phpt
index f72f91d17b..abccceb8de 100644
--- a/Zend/tests/compare_001_64bit.phpt
+++ b/Zend/tests/compare_001_64bit.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var == $a[$i]) ? " == " : " != ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var == $a[$i]) ? " == " : " != ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
@@ -70,7 +70,7 @@ string(0) "" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(0) "" == string(0) ""
string(0) "" != int(1)
string(0) "" != float(2.5)
-string(0) "" == int(0)
+string(0) "" != int(0)
string(0) "" != string(6) "string"
string(0) "" != string(3) "123"
string(0) "" != string(3) "2.5"
@@ -130,11 +130,11 @@ float(2.5) != array(0) {}
float(2.5) != int(-9223372036854775808)
float(2.5) != string(20) "-9223372036854775808"
int(0) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(0) == string(0) ""
+int(0) != string(0) ""
int(0) != int(1)
int(0) != float(2.5)
int(0) == int(0)
-int(0) == string(6) "string"
+int(0) != string(6) "string"
int(0) != string(3) "123"
int(0) != string(3) "2.5"
int(0) == NULL
@@ -156,7 +156,7 @@ string(6) "string" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(6) "string" != string(0) ""
string(6) "string" != int(1)
string(6) "string" != float(2.5)
-string(6) "string" == int(0)
+string(6) "string" != int(0)
string(6) "string" == string(6) "string"
string(6) "string" != string(3) "123"
string(6) "string" != string(3) "2.5"
diff --git a/Zend/tests/compare_002.phpt b/Zend/tests/compare_002.phpt
index 9e3eb86d57..f4646c84fa 100644
--- a/Zend/tests/compare_002.phpt
+++ b/Zend/tests/compare_002.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var === $a[$i]) ? " === " : " !== ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var === $a[$i]) ? " === " : " !== ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
diff --git a/Zend/tests/compare_002_64bit.phpt b/Zend/tests/compare_002_64bit.phpt
index a18269e9f3..b0418cca11 100644
--- a/Zend/tests/compare_002_64bit.phpt
+++ b/Zend/tests/compare_002_64bit.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var === $a[$i]) ? " === " : " !== ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var === $a[$i]) ? " === " : " !== ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
diff --git a/Zend/tests/compare_003.phpt b/Zend/tests/compare_003.phpt
index 4cb7a027cd..a47335633e 100644
--- a/Zend/tests/compare_003.phpt
+++ b/Zend/tests/compare_003.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var > $a[$i]) ? " > " : " <= ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var > $a[$i]) ? " > " : " <= ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
@@ -81,14 +81,14 @@ string(0) "" <= object(stdClass)#1 (0) {}
string(0) "" <= object(stdClass)#2 (0) {}
string(0) "" <= object(test)#3 (0) {}
string(0) "" <= array(0) {}
-string(0) "" > int(-2147483648)
+string(0) "" <= int(-2147483648)
string(0) "" <= string(11) "-2147483648"
int(1) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
int(1) > string(0) ""
int(1) <= int(1)
int(1) <= float(2.5)
int(1) > int(0)
-int(1) > string(6) "string"
+int(1) <= string(6) "string"
int(1) <= string(3) "123"
int(1) <= string(3) "2.5"
int(1) > NULL
@@ -111,7 +111,7 @@ float(2.5) > string(0) ""
float(2.5) > int(1)
float(2.5) <= float(2.5)
float(2.5) > int(0)
-float(2.5) > string(6) "string"
+float(2.5) <= string(6) "string"
float(2.5) <= string(3) "123"
float(2.5) <= string(3) "2.5"
float(2.5) > NULL
@@ -130,7 +130,7 @@ float(2.5) <= array(0) {}
float(2.5) > int(-2147483648)
float(2.5) > string(11) "-2147483648"
int(0) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(0) <= string(0) ""
+int(0) > string(0) ""
int(0) <= int(1)
int(0) <= float(2.5)
int(0) <= int(0)
@@ -154,9 +154,9 @@ int(0) > int(-2147483648)
int(0) > string(11) "-2147483648"
string(6) "string" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(6) "string" > string(0) ""
-string(6) "string" <= int(1)
-string(6) "string" <= float(2.5)
-string(6) "string" <= int(0)
+string(6) "string" > int(1)
+string(6) "string" > float(2.5)
+string(6) "string" > int(0)
string(6) "string" <= string(6) "string"
string(6) "string" > string(3) "123"
string(6) "string" > string(3) "2.5"
@@ -347,7 +347,7 @@ array(0) {} <= array(0) {}
array(0) {} > int(-2147483648)
array(0) {} > string(11) "-2147483648"
int(-2147483648) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(-2147483648) <= string(0) ""
+int(-2147483648) > string(0) ""
int(-2147483648) <= int(1)
int(-2147483648) <= float(2.5)
int(-2147483648) <= int(0)
diff --git a/Zend/tests/compare_003_64bit.phpt b/Zend/tests/compare_003_64bit.phpt
index 2c361257ae..359f53a861 100644
--- a/Zend/tests/compare_003_64bit.phpt
+++ b/Zend/tests/compare_003_64bit.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var > $a[$i]) ? " > " : " <= ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var > $a[$i]) ? " > " : " <= ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
@@ -81,14 +81,14 @@ string(0) "" <= object(stdClass)#%d (0) {}
string(0) "" <= object(stdClass)#%d (0) {}
string(0) "" <= object(test)#%d (0) {}
string(0) "" <= array(0) {}
-string(0) "" > int(-9223372036854775808)
+string(0) "" <= int(-9223372036854775808)
string(0) "" <= string(20) "-9223372036854775808"
int(1) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
int(1) > string(0) ""
int(1) <= int(1)
int(1) <= float(2.5)
int(1) > int(0)
-int(1) > string(6) "string"
+int(1) <= string(6) "string"
int(1) <= string(3) "123"
int(1) <= string(3) "2.5"
int(1) > NULL
@@ -111,7 +111,7 @@ float(2.5) > string(0) ""
float(2.5) > int(1)
float(2.5) <= float(2.5)
float(2.5) > int(0)
-float(2.5) > string(6) "string"
+float(2.5) <= string(6) "string"
float(2.5) <= string(3) "123"
float(2.5) <= string(3) "2.5"
float(2.5) > NULL
@@ -130,7 +130,7 @@ float(2.5) <= array(0) {}
float(2.5) > int(-9223372036854775808)
float(2.5) > string(20) "-9223372036854775808"
int(0) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(0) <= string(0) ""
+int(0) > string(0) ""
int(0) <= int(1)
int(0) <= float(2.5)
int(0) <= int(0)
@@ -154,9 +154,9 @@ int(0) > int(-9223372036854775808)
int(0) > string(20) "-9223372036854775808"
string(6) "string" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(6) "string" > string(0) ""
-string(6) "string" <= int(1)
-string(6) "string" <= float(2.5)
-string(6) "string" <= int(0)
+string(6) "string" > int(1)
+string(6) "string" > float(2.5)
+string(6) "string" > int(0)
string(6) "string" <= string(6) "string"
string(6) "string" > string(3) "123"
string(6) "string" > string(3) "2.5"
@@ -347,7 +347,7 @@ array(0) {} <= array(0) {}
array(0) {} > int(-9223372036854775808)
array(0) {} > string(20) "-9223372036854775808"
int(-9223372036854775808) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(-9223372036854775808) <= string(0) ""
+int(-9223372036854775808) > string(0) ""
int(-9223372036854775808) <= int(1)
int(-9223372036854775808) <= float(2.5)
int(-9223372036854775808) <= int(0)
diff --git a/Zend/tests/compare_004.phpt b/Zend/tests/compare_004.phpt
index 1d13f36334..e6755101c2 100644
--- a/Zend/tests/compare_004.phpt
+++ b/Zend/tests/compare_004.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var < $a[$i]) ? " < " : " >= ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var < $a[$i]) ? " < " : " >= ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
@@ -70,7 +70,7 @@ string(0) "" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(0) "" >= string(0) ""
string(0) "" < int(1)
string(0) "" < float(2.5)
-string(0) "" >= int(0)
+string(0) "" < int(0)
string(0) "" < string(6) "string"
string(0) "" < string(3) "123"
string(0) "" < string(3) "2.5"
@@ -81,14 +81,14 @@ string(0) "" < object(stdClass)#1 (0) {}
string(0) "" < object(stdClass)#2 (0) {}
string(0) "" < object(test)#3 (0) {}
string(0) "" < array(0) {}
-string(0) "" >= int(-2147483648)
+string(0) "" < int(-2147483648)
string(0) "" < string(11) "-2147483648"
int(1) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
int(1) >= string(0) ""
int(1) >= int(1)
int(1) < float(2.5)
int(1) >= int(0)
-int(1) >= string(6) "string"
+int(1) < string(6) "string"
int(1) < string(3) "123"
int(1) < string(3) "2.5"
int(1) >= NULL
@@ -111,7 +111,7 @@ float(2.5) >= string(0) ""
float(2.5) >= int(1)
float(2.5) >= float(2.5)
float(2.5) >= int(0)
-float(2.5) >= string(6) "string"
+float(2.5) < string(6) "string"
float(2.5) < string(3) "123"
float(2.5) >= string(3) "2.5"
float(2.5) >= NULL
@@ -134,7 +134,7 @@ int(0) >= string(0) ""
int(0) < int(1)
int(0) < float(2.5)
int(0) >= int(0)
-int(0) >= string(6) "string"
+int(0) < string(6) "string"
int(0) < string(3) "123"
int(0) < string(3) "2.5"
int(0) >= NULL
@@ -154,8 +154,8 @@ int(0) >= int(-2147483648)
int(0) >= string(11) "-2147483648"
string(6) "string" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(6) "string" >= string(0) ""
-string(6) "string" < int(1)
-string(6) "string" < float(2.5)
+string(6) "string" >= int(1)
+string(6) "string" >= float(2.5)
string(6) "string" >= int(0)
string(6) "string" >= string(6) "string"
string(6) "string" >= string(3) "123"
@@ -347,7 +347,7 @@ array(0) {} >= array(0) {}
array(0) {} >= int(-2147483648)
array(0) {} >= string(11) "-2147483648"
int(-2147483648) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(-2147483648) < string(0) ""
+int(-2147483648) >= string(0) ""
int(-2147483648) < int(1)
int(-2147483648) < float(2.5)
int(-2147483648) < int(0)
diff --git a/Zend/tests/compare_004_64bit.phpt b/Zend/tests/compare_004_64bit.phpt
index 8a69ae7816..db44ef4737 100644
--- a/Zend/tests/compare_004_64bit.phpt
+++ b/Zend/tests/compare_004_64bit.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var < $a[$i]) ? " < " : " >= ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var < $a[$i]) ? " < " : " >= ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
@@ -70,7 +70,7 @@ string(0) "" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(0) "" >= string(0) ""
string(0) "" < int(1)
string(0) "" < float(2.5)
-string(0) "" >= int(0)
+string(0) "" < int(0)
string(0) "" < string(6) "string"
string(0) "" < string(3) "123"
string(0) "" < string(3) "2.5"
@@ -81,14 +81,14 @@ string(0) "" < object(stdClass)#%d (0) {}
string(0) "" < object(stdClass)#%d (0) {}
string(0) "" < object(test)#%d (0) {}
string(0) "" < array(0) {}
-string(0) "" >= int(-9223372036854775808)
+string(0) "" < int(-9223372036854775808)
string(0) "" < string(20) "-9223372036854775808"
int(1) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
int(1) >= string(0) ""
int(1) >= int(1)
int(1) < float(2.5)
int(1) >= int(0)
-int(1) >= string(6) "string"
+int(1) < string(6) "string"
int(1) < string(3) "123"
int(1) < string(3) "2.5"
int(1) >= NULL
@@ -111,7 +111,7 @@ float(2.5) >= string(0) ""
float(2.5) >= int(1)
float(2.5) >= float(2.5)
float(2.5) >= int(0)
-float(2.5) >= string(6) "string"
+float(2.5) < string(6) "string"
float(2.5) < string(3) "123"
float(2.5) >= string(3) "2.5"
float(2.5) >= NULL
@@ -134,7 +134,7 @@ int(0) >= string(0) ""
int(0) < int(1)
int(0) < float(2.5)
int(0) >= int(0)
-int(0) >= string(6) "string"
+int(0) < string(6) "string"
int(0) < string(3) "123"
int(0) < string(3) "2.5"
int(0) >= NULL
@@ -154,8 +154,8 @@ int(0) >= int(-9223372036854775808)
int(0) >= string(20) "-9223372036854775808"
string(6) "string" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(6) "string" >= string(0) ""
-string(6) "string" < int(1)
-string(6) "string" < float(2.5)
+string(6) "string" >= int(1)
+string(6) "string" >= float(2.5)
string(6) "string" >= int(0)
string(6) "string" >= string(6) "string"
string(6) "string" >= string(3) "123"
@@ -347,7 +347,7 @@ array(0) {} >= array(0) {}
array(0) {} >= int(-9223372036854775808)
array(0) {} >= string(20) "-9223372036854775808"
int(-9223372036854775808) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(-9223372036854775808) < string(0) ""
+int(-9223372036854775808) >= string(0) ""
int(-9223372036854775808) < int(1)
int(-9223372036854775808) < float(2.5)
int(-9223372036854775808) < int(0)
diff --git a/Zend/tests/compare_005.phpt b/Zend/tests/compare_005.phpt
index 43ed96e70b..0b5b0ed7fd 100644
--- a/Zend/tests/compare_005.phpt
+++ b/Zend/tests/compare_005.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var >= $a[$i]) ? " >= " : " < ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var >= $a[$i]) ? " >= " : " < ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
@@ -70,7 +70,7 @@ string(0) "" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(0) "" >= string(0) ""
string(0) "" < int(1)
string(0) "" < float(2.5)
-string(0) "" >= int(0)
+string(0) "" < int(0)
string(0) "" < string(6) "string"
string(0) "" < string(3) "123"
string(0) "" < string(3) "2.5"
@@ -81,14 +81,14 @@ string(0) "" < object(stdClass)#1 (0) {}
string(0) "" < object(stdClass)#2 (0) {}
string(0) "" < object(test)#3 (0) {}
string(0) "" < array(0) {}
-string(0) "" >= int(-2147483648)
+string(0) "" < int(-2147483648)
string(0) "" < string(11) "-2147483648"
int(1) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
int(1) >= string(0) ""
int(1) >= int(1)
int(1) < float(2.5)
int(1) >= int(0)
-int(1) >= string(6) "string"
+int(1) < string(6) "string"
int(1) < string(3) "123"
int(1) < string(3) "2.5"
int(1) >= NULL
@@ -111,7 +111,7 @@ float(2.5) >= string(0) ""
float(2.5) >= int(1)
float(2.5) >= float(2.5)
float(2.5) >= int(0)
-float(2.5) >= string(6) "string"
+float(2.5) < string(6) "string"
float(2.5) < string(3) "123"
float(2.5) >= string(3) "2.5"
float(2.5) >= NULL
@@ -134,7 +134,7 @@ int(0) >= string(0) ""
int(0) < int(1)
int(0) < float(2.5)
int(0) >= int(0)
-int(0) >= string(6) "string"
+int(0) < string(6) "string"
int(0) < string(3) "123"
int(0) < string(3) "2.5"
int(0) >= NULL
@@ -154,8 +154,8 @@ int(0) >= int(-2147483648)
int(0) >= string(11) "-2147483648"
string(6) "string" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(6) "string" >= string(0) ""
-string(6) "string" < int(1)
-string(6) "string" < float(2.5)
+string(6) "string" >= int(1)
+string(6) "string" >= float(2.5)
string(6) "string" >= int(0)
string(6) "string" >= string(6) "string"
string(6) "string" >= string(3) "123"
@@ -347,7 +347,7 @@ array(0) {} >= array(0) {}
array(0) {} >= int(-2147483648)
array(0) {} >= string(11) "-2147483648"
int(-2147483648) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(-2147483648) < string(0) ""
+int(-2147483648) >= string(0) ""
int(-2147483648) < int(1)
int(-2147483648) < float(2.5)
int(-2147483648) < int(0)
diff --git a/Zend/tests/compare_005_64bit.phpt b/Zend/tests/compare_005_64bit.phpt
index 821f2a0ee4..c29bd332bf 100644
--- a/Zend/tests/compare_005_64bit.phpt
+++ b/Zend/tests/compare_005_64bit.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var >= $a[$i]) ? " >= " : " < ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var >= $a[$i]) ? " >= " : " < ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
@@ -70,7 +70,7 @@ string(0) "" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(0) "" >= string(0) ""
string(0) "" < int(1)
string(0) "" < float(2.5)
-string(0) "" >= int(0)
+string(0) "" < int(0)
string(0) "" < string(6) "string"
string(0) "" < string(3) "123"
string(0) "" < string(3) "2.5"
@@ -81,14 +81,14 @@ string(0) "" < object(stdClass)#%d (0) {}
string(0) "" < object(stdClass)#%d (0) {}
string(0) "" < object(test)#%d (0) {}
string(0) "" < array(0) {}
-string(0) "" >= int(-9223372036854775808)
+string(0) "" < int(-9223372036854775808)
string(0) "" < string(20) "-9223372036854775808"
int(1) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
int(1) >= string(0) ""
int(1) >= int(1)
int(1) < float(2.5)
int(1) >= int(0)
-int(1) >= string(6) "string"
+int(1) < string(6) "string"
int(1) < string(3) "123"
int(1) < string(3) "2.5"
int(1) >= NULL
@@ -111,7 +111,7 @@ float(2.5) >= string(0) ""
float(2.5) >= int(1)
float(2.5) >= float(2.5)
float(2.5) >= int(0)
-float(2.5) >= string(6) "string"
+float(2.5) < string(6) "string"
float(2.5) < string(3) "123"
float(2.5) >= string(3) "2.5"
float(2.5) >= NULL
@@ -134,7 +134,7 @@ int(0) >= string(0) ""
int(0) < int(1)
int(0) < float(2.5)
int(0) >= int(0)
-int(0) >= string(6) "string"
+int(0) < string(6) "string"
int(0) < string(3) "123"
int(0) < string(3) "2.5"
int(0) >= NULL
@@ -154,8 +154,8 @@ int(0) >= int(-9223372036854775808)
int(0) >= string(20) "-9223372036854775808"
string(6) "string" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(6) "string" >= string(0) ""
-string(6) "string" < int(1)
-string(6) "string" < float(2.5)
+string(6) "string" >= int(1)
+string(6) "string" >= float(2.5)
string(6) "string" >= int(0)
string(6) "string" >= string(6) "string"
string(6) "string" >= string(3) "123"
@@ -347,7 +347,7 @@ array(0) {} >= array(0) {}
array(0) {} >= int(-9223372036854775808)
array(0) {} >= string(20) "-9223372036854775808"
int(-9223372036854775808) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(-9223372036854775808) < string(0) ""
+int(-9223372036854775808) >= string(0) ""
int(-9223372036854775808) < int(1)
int(-9223372036854775808) < float(2.5)
int(-9223372036854775808) < int(0)
diff --git a/Zend/tests/compare_006.phpt b/Zend/tests/compare_006.phpt
index 1c212c5487..4657a0d0a5 100644
--- a/Zend/tests/compare_006.phpt
+++ b/Zend/tests/compare_006.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var <= $a[$i]) ? " <= " : " > ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var <= $a[$i]) ? " <= " : " > ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
@@ -81,14 +81,14 @@ string(0) "" <= object(stdClass)#1 (0) {}
string(0) "" <= object(stdClass)#2 (0) {}
string(0) "" <= object(test)#3 (0) {}
string(0) "" <= array(0) {}
-string(0) "" > int(-2147483648)
+string(0) "" <= int(-2147483648)
string(0) "" <= string(11) "-2147483648"
int(1) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
int(1) > string(0) ""
int(1) <= int(1)
int(1) <= float(2.5)
int(1) > int(0)
-int(1) > string(6) "string"
+int(1) <= string(6) "string"
int(1) <= string(3) "123"
int(1) <= string(3) "2.5"
int(1) > NULL
@@ -111,7 +111,7 @@ float(2.5) > string(0) ""
float(2.5) > int(1)
float(2.5) <= float(2.5)
float(2.5) > int(0)
-float(2.5) > string(6) "string"
+float(2.5) <= string(6) "string"
float(2.5) <= string(3) "123"
float(2.5) <= string(3) "2.5"
float(2.5) > NULL
@@ -130,7 +130,7 @@ float(2.5) <= array(0) {}
float(2.5) > int(-2147483648)
float(2.5) > string(11) "-2147483648"
int(0) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(0) <= string(0) ""
+int(0) > string(0) ""
int(0) <= int(1)
int(0) <= float(2.5)
int(0) <= int(0)
@@ -154,9 +154,9 @@ int(0) > int(-2147483648)
int(0) > string(11) "-2147483648"
string(6) "string" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(6) "string" > string(0) ""
-string(6) "string" <= int(1)
-string(6) "string" <= float(2.5)
-string(6) "string" <= int(0)
+string(6) "string" > int(1)
+string(6) "string" > float(2.5)
+string(6) "string" > int(0)
string(6) "string" <= string(6) "string"
string(6) "string" > string(3) "123"
string(6) "string" > string(3) "2.5"
@@ -347,7 +347,7 @@ array(0) {} <= array(0) {}
array(0) {} > int(-2147483648)
array(0) {} > string(11) "-2147483648"
int(-2147483648) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(-2147483648) <= string(0) ""
+int(-2147483648) > string(0) ""
int(-2147483648) <= int(1)
int(-2147483648) <= float(2.5)
int(-2147483648) <= int(0)
diff --git a/Zend/tests/compare_006_64bit.phpt b/Zend/tests/compare_006_64bit.phpt
index 41973a990d..a284dc1f45 100644
--- a/Zend/tests/compare_006_64bit.phpt
+++ b/Zend/tests/compare_006_64bit.phpt
@@ -9,41 +9,41 @@ class test {
}
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- new stdclass,
- new test,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ new stdclass,
+ new test,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
$var_cnt = count($a);
function my_dump($var) {
- ob_start();
- var_dump($var);
- $buf = ob_get_clean();
- echo str_replace("\n", "", $buf);
+ ob_start();
+ var_dump($var);
+ $buf = ob_get_clean();
+ echo str_replace("\n", "", $buf);
}
foreach($a as $var) {
- for ($i = 0; $i < $var_cnt; $i++) {
- my_dump($var);
- echo ($var <= $a[$i]) ? " <= " : " > ";
- my_dump($a[$i]);
- echo "\n";
- }
+ for ($i = 0; $i < $var_cnt; $i++) {
+ my_dump($var);
+ echo ($var <= $a[$i]) ? " <= " : " > ";
+ my_dump($a[$i]);
+ echo "\n";
+ }
}
echo "Done\n";
@@ -81,14 +81,14 @@ string(0) "" <= object(stdClass)#%d (0) {}
string(0) "" <= object(stdClass)#%d (0) {}
string(0) "" <= object(test)#%d (0) {}
string(0) "" <= array(0) {}
-string(0) "" > int(-9223372036854775808)
+string(0) "" <= int(-9223372036854775808)
string(0) "" <= string(20) "-9223372036854775808"
int(1) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
int(1) > string(0) ""
int(1) <= int(1)
int(1) <= float(2.5)
int(1) > int(0)
-int(1) > string(6) "string"
+int(1) <= string(6) "string"
int(1) <= string(3) "123"
int(1) <= string(3) "2.5"
int(1) > NULL
@@ -111,7 +111,7 @@ float(2.5) > string(0) ""
float(2.5) > int(1)
float(2.5) <= float(2.5)
float(2.5) > int(0)
-float(2.5) > string(6) "string"
+float(2.5) <= string(6) "string"
float(2.5) <= string(3) "123"
float(2.5) <= string(3) "2.5"
float(2.5) > NULL
@@ -130,7 +130,7 @@ float(2.5) <= array(0) {}
float(2.5) > int(-9223372036854775808)
float(2.5) > string(20) "-9223372036854775808"
int(0) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(0) <= string(0) ""
+int(0) > string(0) ""
int(0) <= int(1)
int(0) <= float(2.5)
int(0) <= int(0)
@@ -154,9 +154,9 @@ int(0) > int(-9223372036854775808)
int(0) > string(20) "-9223372036854775808"
string(6) "string" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
string(6) "string" > string(0) ""
-string(6) "string" <= int(1)
-string(6) "string" <= float(2.5)
-string(6) "string" <= int(0)
+string(6) "string" > int(1)
+string(6) "string" > float(2.5)
+string(6) "string" > int(0)
string(6) "string" <= string(6) "string"
string(6) "string" > string(3) "123"
string(6) "string" > string(3) "2.5"
@@ -347,7 +347,7 @@ array(0) {} <= array(0) {}
array(0) {} > int(-9223372036854775808)
array(0) {} > string(20) "-9223372036854775808"
int(-9223372036854775808) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)}
-int(-9223372036854775808) <= string(0) ""
+int(-9223372036854775808) > string(0) ""
int(-9223372036854775808) <= int(1)
int(-9223372036854775808) <= float(2.5)
int(-9223372036854775808) <= int(0)
diff --git a/Zend/tests/compound_assign_failure.phpt b/Zend/tests/compound_assign_failure.phpt
index 2e35ab4fff..0dc9af85f2 100644
--- a/Zend/tests/compound_assign_failure.phpt
+++ b/Zend/tests/compound_assign_failure.phpt
@@ -6,141 +6,197 @@ opcache.optimization_level=0
<?php
try {
- $a = 1;
- $a %= 0;
+ $a = 1;
+ $a %= 0;
} catch (Error $e) { var_dump($a); }
try {
- $a = 1;
- $a >>= -1;
+ $a = 1;
+ $a >>= -1;
} catch (Error $e) { var_dump($a); }
try {
- $a = 1;
- $a <<= -1;
+ $a = 1;
+ $a <<= -1;
} catch (Error $e) { var_dump($a); }
set_error_handler(function($type, $msg) { throw new Exception($msg); });
try {
- $a = [];
- $a .= "foo";
+ $a = [];
+ $a .= "foo";
} catch (Throwable $e) { var_dump($a); }
try {
- $a = "foo";
- $a .= [];
+ $a = "foo";
+ $a .= [];
} catch (Throwable $e) { var_dump($a); }
$x = new stdClass;
try { $x += 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x += new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
+var_dump($x);
+
+$x = "foo";
+try { $x += new stdClass; }
+catch (Throwable $e) {}
var_dump($x);
$x = new stdClass;
try { $x -= 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x -= new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
+var_dump($x);
+
+$x = "foo";
+try { $x -= new stdClass; }
+catch (Throwable $e) {}
var_dump($x);
$x = new stdClass;
try { $x *= 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x *= new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
+var_dump($x);
+
+$x = "foo";
+try { $x *= new stdClass; }
+catch (Throwable $e) {}
var_dump($x);
$x = new stdClass;
try { $x /= 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x /= new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
+var_dump($x);
+
+$x = "foo";
+try { $x /= new stdClass; }
+catch (Throwable $e) {}
var_dump($x);
$x = new stdClass;
try { $x %= 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x %= new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
+var_dump($x);
+
+$x = "foo";
+try { $x %= new stdClass; }
+catch (Throwable $e) {}
var_dump($x);
$x = new stdClass;
try { $x **= 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x **= new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
+var_dump($x);
+
+$x = "foo";
+try { $x **= new stdClass; }
+catch (Throwable $e) {}
var_dump($x);
$x = new stdClass;
try { $x ^= 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x ^= new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
+var_dump($x);
+
+$x = "foo";
+try { $x ^= new stdClass; }
+catch (Throwable $e) {}
var_dump($x);
$x = new stdClass;
try { $x &= 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x &= new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
+var_dump($x);
+
+$x = "foo";
+try { $x &= new stdClass; }
+catch (Throwable $e) {}
var_dump($x);
$x = new stdClass;
try { $x |= 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x |= new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
+var_dump($x);
+
+$x = "foo";
+try { $x |= new stdClass; }
+catch (Throwable $e) {}
var_dump($x);
$x = new stdClass;
try { $x <<= 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x <<= new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
+var_dump($x);
+
+$x = "foo";
+try { $x <<= new stdClass; }
+catch (Throwable $e) {}
var_dump($x);
$x = new stdClass;
try { $x >>= 1; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
$x = 1;
try { $x >>= new stdClass; }
-catch (Exception $e) {}
+catch (Throwable $e) {}
var_dump($x);
+
+$x = "foo";
+try { $x >>= new stdClass; }
+catch (Throwable $e) {}
+var_dump($x);
+
?>
--EXPECTF--
int(1)
@@ -152,33 +208,44 @@ string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
object(stdClass)#%d (0) {
}
int(1)
+string(3) "foo"
diff --git a/Zend/tests/compound_assign_with_numeric_strings.phpt b/Zend/tests/compound_assign_with_numeric_strings.phpt
index e5cdb344ef..c6cee53d95 100644
--- a/Zend/tests/compound_assign_with_numeric_strings.phpt
+++ b/Zend/tests/compound_assign_with_numeric_strings.phpt
@@ -12,7 +12,7 @@ try {
$n <<= $n;
var_dump($n);
} catch (ArithmeticError $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$n = "65";
@@ -24,7 +24,7 @@ try {
$n >>= $n;
var_dump($n);
} catch (ArithmeticError $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$n = "0";
@@ -32,12 +32,13 @@ try{
$n %= $n;
var_dump($n);
} catch (DivisionByZeroError $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$n = "-1";
$n %= $n;
var_dump($n);
+?>
--EXPECT--
int(0)
diff --git a/Zend/tests/concat_001.phpt b/Zend/tests/concat_001.phpt
index 1e657954a9..887370aee7 100644
--- a/Zend/tests/concat_001.phpt
+++ b/Zend/tests/concat_001.phpt
@@ -6,9 +6,9 @@ precision=14
<?php
class test {
- function __toString() {
- return "this is test object";
- }
+ function __toString() {
+ return "this is test object";
+ }
}
$a = array(1,2,3);
@@ -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/const_array_with_resource_key.phpt b/Zend/tests/const_array_with_resource_key.phpt
index 0bf546af50..1e3dee4734 100644
--- a/Zend/tests/const_array_with_resource_key.phpt
+++ b/Zend/tests/const_array_with_resource_key.phpt
@@ -8,7 +8,7 @@ var_dump(FOO);
?>
--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
array(1) {
[%d]=>
int(42)
diff --git a/Zend/tests/const_deprecation.phpt b/Zend/tests/const_deprecation.phpt
new file mode 100644
index 0000000000..b7cf99d52e
--- /dev/null
+++ b/Zend/tests/const_deprecation.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Internal constant deprecation
+--SKIPIF--
+<?php
+if (!extension_loaded('zend-test')) die('skip requires zend-test');
+?>
+--FILE--
+<?php
+
+var_dump(ZEND_TEST_DEPRECATED);
+var_dump(constant('ZEND_TEST_DEPRECATED'));
+
+const X = ZEND_TEST_DEPRECATED;
+var_dump(X);
+
+?>
+--EXPECTF--
+Deprecated: Constant ZEND_TEST_DEPRECATED is deprecated in %s on line %d
+int(42)
+
+Deprecated: Constant ZEND_TEST_DEPRECATED is deprecated in %s on line %d
+int(42)
+
+Deprecated: Constant ZEND_TEST_DEPRECATED is deprecated in %s on line %d
+int(42)
diff --git a/Zend/tests/const_dereference_001.phpt b/Zend/tests/const_dereference_001.phpt
index 5fe6e4d433..9614cfece4 100644
--- a/Zend/tests/const_dereference_001.phpt
+++ b/Zend/tests/const_dereference_001.phpt
@@ -15,7 +15,7 @@ foreach (array(array(1, 2, 3))[0] as $var) {
--EXPECTF--
int(4)
-Notice: Undefined index: foo in %sconst_dereference_001.php on line %d
+Warning: Undefined array key "foo" in %s on line %d
NULL
int(6)
123
diff --git a/Zend/tests/const_dereference_002.phpt b/Zend/tests/const_dereference_002.phpt
index 1320029baa..7d83acadbd 100644
--- a/Zend/tests/const_dereference_002.phpt
+++ b/Zend/tests/const_dereference_002.phpt
@@ -6,12 +6,13 @@ error_reporting(E_ALL);
var_dump("foobar"[3]);
var_dump("foobar"[2][0]);
-var_dump("foobar"["foo"]["bar"]);
+var_dump("foobar"["0foo"]["0bar"]);
+?>
--EXPECTF--
string(1) "b"
string(1) "o"
-Warning: Illegal string offset 'foo' in %sconst_dereference_002.php on line %d
+Warning: Illegal string offset "0foo" in %s on line %d
-Warning: Illegal string offset 'bar' in %sconst_dereference_002.php on line %d
+Warning: Illegal string offset "0bar" in %s on line %d
string(1) "f"
diff --git a/Zend/tests/const_dereference_003.phpt b/Zend/tests/const_dereference_003.phpt
index 810ad14b8e..06c18e7169 100644
--- a/Zend/tests/const_dereference_003.phpt
+++ b/Zend/tests/const_dereference_003.phpt
@@ -15,7 +15,7 @@ foreach (array([1, 2, 3])[0] as $var) {
--EXPECTF--
int(4)
-Notice: Undefined index: foo in %sconst_dereference_003.php on line %d
+Warning: Undefined array key "foo" in %s on line %d
NULL
int(6)
123
diff --git a/Zend/tests/constant_arrays.phpt b/Zend/tests/constant_arrays.phpt
index 06d911328c..84f71fccf2 100644
--- a/Zend/tests/constant_arrays.phpt
+++ b/Zend/tests/constant_arrays.phpt
@@ -24,12 +24,22 @@ $y[0] = 3;
var_dump($x, $y, QUX);
// ensure objects not allowed in arrays
-var_dump(define('ELEPHPANT', [new StdClass]));
+try {
+ define('ELEPHPANT', [new StdClass]);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
// ensure recursion doesn't crash
$recursive = [];
$recursive[0] = &$recursive;
-var_dump(define('RECURSION', $recursive));
+
+try {
+ define('RECURSION', $recursive);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+?>
--EXPECTF--
array(4) {
[0]=>
@@ -92,9 +102,5 @@ array(1) {
[0]=>
int(7)
}
-
-Warning: Constants may only evaluate to scalar values, arrays or resources in %s on line %d
-bool(false)
-
-Warning: Constants cannot be recursive arrays in %s on line %d
-bool(false)
+define(): Argument #2 ($value) cannot be an object, stdClass given
+define(): Argument #2 ($value) cannot be a recursive array
diff --git a/Zend/tests/constant_expressions_arrays.phpt b/Zend/tests/constant_expressions_arrays.phpt
index 2ab03453de..d25a97755e 100644
--- a/Zend/tests/constant_expressions_arrays.phpt
+++ b/Zend/tests/constant_expressions_arrays.phpt
@@ -11,13 +11,13 @@ const e = ["string" => [1]]["string"][0];
var_dump(b, c, e);
function test ($a = d[1][0]) {
- var_dump($a);
+ var_dump($a);
}
test();
class foo {
- const bar = [1][0];
+ const bar = [1][0];
}
var_dump(foo::bar);
@@ -32,7 +32,7 @@ int(1)
int(4)
int(1)
-Notice: Undefined offset: 3 in %s on line %d
+Warning: Undefined array key 3 in %s on line %d
array(3) {
[0]=>
int(1)
diff --git a/Zend/tests/constant_expressions_classes.phpt b/Zend/tests/constant_expressions_classes.phpt
index eed006bfe1..6cca717672 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
@@ -14,7 +12,7 @@ $classlist = [
'A'=> 'class A { const HW = "this is A"; }',
'B'=> 'class B extends A { const HW = parent::HW." extended by B"; }',
'space1\C' => 'namespace space1; class C { const HW = "this is space1\C"; }',
- 'D' => 'class D { const HW = \space1\C::HW." extented by D"; }',
+ 'D' => 'class D { const HW = \space1\C::HW." extended by D"; }',
'trE' => 'trait trE { public static function getHW() { return parent::HW; } }',
'E' => 'class E extends B { use trE; }',
'F' => 'class F { const XX = "this is F"; }',
@@ -22,11 +20,11 @@ $classlist = [
];
spl_autoload_register(function ($class) use ($classlist) {
- if (isset($classlist[$class])) {
- eval($classlist[$class]);
- } else {
- die("Cannot autoload $class\n");
- }
+ if (isset($classlist[$class])) {
+ eval($classlist[$class]);
+ } else {
+ die("Cannot autoload $class\n");
+ }
});
printf("B::HW = %s\n", B::HW);
@@ -38,6 +36,6 @@ printf("G::get_me() = %s\n", G::get_me());
?>
--EXPECT--
B::HW = this is A extended by B
-D::HW = this is space1\C extented by D
+D::HW = this is space1\C extended by D
E::getHW() = this is A extended by B
G::get_me() = got this is F extended by G
diff --git a/Zend/tests/constant_expressions_coalesce.phpt b/Zend/tests/constant_expressions_coalesce.phpt
index 27740aa72e..425aba69c4 100644
--- a/Zend/tests/constant_expressions_coalesce.phpt
+++ b/Zend/tests/constant_expressions_coalesce.phpt
@@ -5,12 +5,6 @@ Constant expressions with null coalescing operator ??
const A = [1 => [[]]];
-// should produce deprecation notices
-const D_1 = null ?? A[1]{'undefined'}['index'] ?? 1;
-const D_2 = null ?? A['undefined']{'index'} ?? 2;
-const D_3 = null ?? A[1]{0}{2} ?? 3; // 2 deprecation notices
-const D_4 = A[1]{0} ?? 4;
-
const T_1 = null ?? A[1]['undefined']['index'] ?? 1;
const T_2 = null ?? A['undefined']['index'] ?? 2;
const T_3 = null ?? A[1][0][2] ?? 3;
@@ -18,11 +12,6 @@ const T_4 = A[1][0][2] ?? 4;
const T_5 = null ?? __LINE__;
const T_6 = __LINE__ ?? "bar";
-var_dump(D_1);
-var_dump(D_2);
-var_dump(D_3);
-var_dump(D_4);
-
var_dump(T_1);
var_dump(T_2);
var_dump(T_3);
@@ -42,21 +31,6 @@ var_dump((new class { public $var = A[1][0][2] ?? 4; })->var);
?>
--EXPECTF--
-
-Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
-
-Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
-
-Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
-
-Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
-
-Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
-int(1)
-int(2)
-int(3)
-array(0) {
-}
int(1)
int(2)
int(3)
diff --git a/Zend/tests/constant_expressions_dynamic.phpt b/Zend/tests/constant_expressions_dynamic.phpt
index 79f8c772e3..fff9f74e52 100644
--- a/Zend/tests/constant_expressions_dynamic.phpt
+++ b/Zend/tests/constant_expressions_dynamic.phpt
@@ -5,7 +5,7 @@ Dynamic Constant Expressions
const C_0 = 0;
const C_1 = 1;
-const C_foo = "foo";
+const C_foo = "0foo";
const C_arr = [0 => 0, "foo" => "foo"];
const T_1 = C_1 | 2;
diff --git a/Zend/tests/constant_expressions_exceptions_001.phpt b/Zend/tests/constant_expressions_exceptions_001.phpt
index 076584a569..279db24372 100644
--- a/Zend/tests/constant_expressions_exceptions_001.phpt
+++ b/Zend/tests/constant_expressions_exceptions_001.phpt
@@ -3,5 +3,9 @@ Constant Expressions with unsupported operands 001
--FILE--
<?php
const T = array(1,2) - array(0);
+?>
--EXPECTF--
-Fatal error: Unsupported operand types in %sconstant_expressions_exceptions_001.php on line 2
+Fatal error: Uncaught TypeError: Unsupported operand types: array - array in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/constant_expressions_exceptions_002.phpt b/Zend/tests/constant_expressions_exceptions_002.phpt
index fc15af5e9a..88c20f10cf 100644
--- a/Zend/tests/constant_expressions_exceptions_002.phpt
+++ b/Zend/tests/constant_expressions_exceptions_002.phpt
@@ -3,11 +3,12 @@ Constant Expressions with unsupported operands 002
--FILE--
<?php
try {
- require("constant_expressions_exceptions.inc");
+ require("constant_expressions_exceptions.inc");
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
+ echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
}
?>
DONE
--EXPECTF--
-Fatal error: Unsupported operand types in %sconstant_expressions_exceptions.inc on line 2
+Exception: Unsupported operand types: array - array in %s on line %d
+DONE
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/constant_expressions_self_referencing_array.phpt b/Zend/tests/constant_expressions_self_referencing_array.phpt
index daa7250641..214862071d 100644
--- a/Zend/tests/constant_expressions_self_referencing_array.phpt
+++ b/Zend/tests/constant_expressions_self_referencing_array.phpt
@@ -9,7 +9,7 @@ class A {
var_dump(A::FOO);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot declare self-referencing constant 'self::BAR' in %s:%d
+Fatal error: Uncaught Error: Cannot declare self-referencing constant self::BAR in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/constants_001.phpt b/Zend/tests/constants_001.phpt
index 8419eb6613..7b274d6fd9 100644
--- a/Zend/tests/constants_001.phpt
+++ b/Zend/tests/constants_001.phpt
@@ -17,7 +17,7 @@ var_dump(constant('1foo'));
?>
--EXPECTF--
-Notice: Constant 1 already defined in %s on line %d
+Warning: Constant 1 already defined in %s on line %d
int(2)
int(2)
int(2)
diff --git a/Zend/tests/constants_002.phpt b/Zend/tests/constants_002.phpt
index b0cf1db61f..309b9c7f9c 100644
--- a/Zend/tests/constants_002.phpt
+++ b/Zend/tests/constants_002.phpt
@@ -3,16 +3,23 @@ Defining constants with non-scalar values
--FILE--
<?php
-define('foo', new stdClass);
-var_dump(foo);
+try {
+ define('foo', new stdClass);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ var_dump(foo);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
define('foo', fopen(__FILE__, 'r'));
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)
+--EXPECT--
+define(): Argument #2 ($value) cannot be an object, stdClass given
+Undefined constant "foo"
+resource(5) of type (stream)
diff --git a/Zend/tests/constants_004.phpt b/Zend/tests/constants_004.phpt
index 69369aa3d9..e981415361 100644
--- a/Zend/tests/constants_004.phpt
+++ b/Zend/tests/constants_004.phpt
@@ -10,4 +10,4 @@ const foo = 2;
?>
--EXPECTF--
-Notice: Constant foo\foo already defined in %s on line %d
+Warning: Constant foo\foo already defined in %s on line %d
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/constants_006.phpt b/Zend/tests/constants_006.phpt
index 6458a07825..77e71de437 100644
--- a/Zend/tests/constants_006.phpt
+++ b/Zend/tests/constants_006.phpt
@@ -10,11 +10,11 @@ var_dump(__file__);
var_dump(__line__);
class foo {
- public function __construct() {
- var_dump(__method__);
- var_dump(__class__);
- var_dump(__function__);
- }
+ public function __construct() {
+ var_dump(__method__);
+ var_dump(__class__);
+ var_dump(__function__);
+ }
}
new foo;
diff --git a/Zend/tests/constants_007.phpt b/Zend/tests/constants_007.phpt
index 7d9f3feb72..c1242dc0c3 100644
--- a/Zend/tests/constants_007.phpt
+++ b/Zend/tests/constants_007.phpt
@@ -8,8 +8,8 @@ const A = 'b';
class a {
- const a = 'c';
- const A = 'd';
+ const a = 'c';
+ const A = 'd';
}
var_dump(a, A, a::a, a::A);
diff --git a/Zend/tests/constants_008.phpt b/Zend/tests/constants_008.phpt
index 226e147ffd..17c6904579 100644
--- a/Zend/tests/constants_008.phpt
+++ b/Zend/tests/constants_008.phpt
@@ -8,10 +8,10 @@ const a = 1;
if (defined('a')) {
- print a;
+ print a;
}
?>
--EXPECTF--
-Notice: Constant a already defined in %s on line %d
+Warning: Constant a already defined in %s on line %d
2
diff --git a/Zend/tests/constants_009.phpt b/Zend/tests/constants_009.phpt
index 35c64dff16..953bc91965 100644
--- a/Zend/tests/constants_009.phpt
+++ b/Zend/tests/constants_009.phpt
@@ -8,7 +8,7 @@ namespace foo\x;
const x = 2;
class x {
- const x = 1;
+ const x = 1;
}
diff --git a/Zend/tests/continue_targeting_switch_warning.phpt b/Zend/tests/continue_targeting_switch_warning.phpt
index 05a51e5a22..379108ad1f 100644
--- a/Zend/tests/continue_targeting_switch_warning.phpt
+++ b/Zend/tests/continue_targeting_switch_warning.phpt
@@ -22,6 +22,21 @@ function test() {
}
}
+ switch ($bar) {
+ case 0:
+ while ($xyz) {
+ continue 2; // INVALID
+ }
+ case 1:
+ while ($xyz) {
+ continue;
+ }
+ case 2:
+ while ($xyz) {
+ break 2;
+ }
+ }
+
while ($foo) {
switch ($bar) {
case 0:
@@ -42,8 +57,10 @@ function test() {
?>
--EXPECTF--
-Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in %s on line 6
+Warning: "continue" targeting switch is equivalent to "break" in %s on line 6
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in %s on line 14
-Warning: "continue 2" targeting switch is equivalent to "break 2". Did you mean to use "continue 3"? in %s on line 26
+Warning: "continue 2" targeting switch is equivalent to "break 2" in %s on line 25
+
+Warning: "continue 2" targeting switch is equivalent to "break 2". Did you mean to use "continue 3"? in %s on line 41
diff --git a/Zend/tests/ctor_promotion_abstract.phpt b/Zend/tests/ctor_promotion_abstract.phpt
new file mode 100644
index 0000000000..937e247acd
--- /dev/null
+++ b/Zend/tests/ctor_promotion_abstract.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Constructor promotion cannot be used inside an abstract constructor
+--FILE--
+<?php
+
+abstract class Test {
+ abstract public function __construct(public int $x);
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot declare promoted property in an abstract constructor in %s on line %d
diff --git a/Zend/tests/ctor_promotion_additional_modifiers.phpt b/Zend/tests/ctor_promotion_additional_modifiers.phpt
new file mode 100644
index 0000000000..1d2e7f3cd5
--- /dev/null
+++ b/Zend/tests/ctor_promotion_additional_modifiers.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Constructor promotion only permits visibility modifiers
+--FILE--
+<?php
+
+class Test {
+ public function __construct(public static $x) {}
+}
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected token "static", expecting variable in %s on line %d
diff --git a/Zend/tests/ctor_promotion_attributes.phpt b/Zend/tests/ctor_promotion_attributes.phpt
new file mode 100644
index 0000000000..1b02eef9df
--- /dev/null
+++ b/Zend/tests/ctor_promotion_attributes.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Attributes on promoted properties are assigned to both the property and parameter
+--FILE--
+<?php
+
+class Test {
+ public function __construct(
+ #[NonNegative]
+ public int $num,
+ ) {}
+}
+
+$prop = new ReflectionProperty(Test::class, 'num');
+var_dump($prop->getAttributes()[0]->getName());
+
+$param = new ReflectionParameter([Test::class, '__construct'], 'num');
+var_dump($param->getAttributes()[0]->getName());
+
+?>
+--EXPECT--
+string(11) "NonNegative"
+string(11) "NonNegative"
diff --git a/Zend/tests/ctor_promotion_basic.phpt b/Zend/tests/ctor_promotion_basic.phpt
new file mode 100644
index 0000000000..206f99fd40
--- /dev/null
+++ b/Zend/tests/ctor_promotion_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Constructor promotion (basic example)
+--FILE--
+<?php
+
+class Point {
+ public function __construct(public int $x, public int $y, public int $z) {}
+}
+
+$point = new Point(1, 2, 3);
+
+// Check that properties really are typed.
+try {
+ $point->x = "foo";
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Cannot assign string to property Point::$x of type int
diff --git a/Zend/tests/ctor_promotion_by_ref.phpt b/Zend/tests/ctor_promotion_by_ref.phpt
new file mode 100644
index 0000000000..4b07149c57
--- /dev/null
+++ b/Zend/tests/ctor_promotion_by_ref.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Constructor promotion of by-ref parameter
+--FILE--
+<?php
+
+class Ary {
+ public function __construct(public array &$array) {}
+}
+
+$array = [];
+$ary = new Ary($array);
+$array[] = 42;
+var_dump($ary->array);
+
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ int(42)
+}
diff --git a/Zend/tests/ctor_promotion_callable_type.phpt b/Zend/tests/ctor_promotion_callable_type.phpt
new file mode 100644
index 0000000000..ae10512ad5
--- /dev/null
+++ b/Zend/tests/ctor_promotion_callable_type.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Type of promoted property may not be callable
+--FILE--
+<?php
+
+class Test {
+ public function __construct(public callable $callable) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Property Test::$callable cannot have type callable in %s on line %d
diff --git a/Zend/tests/ctor_promotion_defaults.phpt b/Zend/tests/ctor_promotion_defaults.phpt
new file mode 100644
index 0000000000..9999e8a539
--- /dev/null
+++ b/Zend/tests/ctor_promotion_defaults.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Constructor promotion with default values
+--FILE--
+<?php
+
+class Point {
+ public function __construct(
+ public float $x = 0.0,
+ public float $y = 1.0,
+ public float $z = 2.0
+ ) {}
+}
+
+var_dump(new Point(10.0));
+var_dump(new Point(10.0, 11.0));
+var_dump(new Point(10.0, 11.0, 12.0));
+
+?>
+--EXPECT--
+object(Point)#1 (3) {
+ ["x"]=>
+ float(10)
+ ["y"]=>
+ float(1)
+ ["z"]=>
+ float(2)
+}
+object(Point)#1 (3) {
+ ["x"]=>
+ float(10)
+ ["y"]=>
+ float(11)
+ ["z"]=>
+ float(2)
+}
+object(Point)#1 (3) {
+ ["x"]=>
+ float(10)
+ ["y"]=>
+ float(11)
+ ["z"]=>
+ float(12)
+}
diff --git a/Zend/tests/ctor_promotion_free_function.phpt b/Zend/tests/ctor_promotion_free_function.phpt
new file mode 100644
index 0000000000..1eb84c5517
--- /dev/null
+++ b/Zend/tests/ctor_promotion_free_function.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Constructor promotion cannot be used in a free function
+--FILE--
+<?php
+
+function __construct(public $prop) {}
+
+?>
+--EXPECTF--
+Fatal error: Cannot declare promoted property outside a constructor in %s on line %d
diff --git a/Zend/tests/ctor_promotion_interface.phpt b/Zend/tests/ctor_promotion_interface.phpt
new file mode 100644
index 0000000000..7cc856b93a
--- /dev/null
+++ b/Zend/tests/ctor_promotion_interface.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Constructor promotion cannot be used inside an abstract constructor (interface variant)
+--FILE--
+<?php
+
+interface Test {
+ public function __construct(public int $x);
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot declare promoted property in an abstract constructor in %s on line %d
diff --git a/Zend/tests/ctor_promotion_mixing.phpt b/Zend/tests/ctor_promotion_mixing.phpt
new file mode 100644
index 0000000000..a527654e79
--- /dev/null
+++ b/Zend/tests/ctor_promotion_mixing.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Constructor promotiong mixed with other properties, parameters and code
+--FILE--
+<?php
+
+class Test {
+ public string $prop2;
+
+ public function __construct(public string $prop1 = "", $param2 = "") {
+ $this->prop2 = $prop1 . $param2;
+ }
+}
+
+var_dump(new Test("Foo", "Bar"));
+echo "\n";
+echo new ReflectionClass(Test::class), "\n";
+
+?>
+--EXPECTF--
+object(Test)#1 (2) {
+ ["prop2"]=>
+ string(6) "FooBar"
+ ["prop1"]=>
+ string(3) "Foo"
+}
+
+Class [ <user> class Test ] {
+ @@ %s
+
+ - Constants [0] {
+ }
+
+ - Static properties [0] {
+ }
+
+ - Static methods [0] {
+ }
+
+ - Properties [2] {
+ Property [ public string $prop2 ]
+ Property [ public string $prop1 ]
+ }
+
+ - Methods [1] {
+ Method [ <user, ctor> public method __construct ] {
+ @@ %s
+
+ - Parameters [2] {
+ Parameter #0 [ <optional> string $prop1 = '' ]
+ Parameter #1 [ <optional> $param2 = '' ]
+ }
+ }
+ }
+}
diff --git a/Zend/tests/ctor_promotion_not_a_ctor.phpt b/Zend/tests/ctor_promotion_not_a_ctor.phpt
new file mode 100644
index 0000000000..110ee8a5ce
--- /dev/null
+++ b/Zend/tests/ctor_promotion_not_a_ctor.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Constructor promotion can only be used in constructors ... duh
+--FILE--
+<?php
+
+class Test {
+ public function foobar(public int $x, public int $y) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot declare promoted property outside a constructor in %s on line %d
diff --git a/Zend/tests/ctor_promotion_null_default.phpt b/Zend/tests/ctor_promotion_null_default.phpt
new file mode 100644
index 0000000000..61c7b2d10c
--- /dev/null
+++ b/Zend/tests/ctor_promotion_null_default.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Constructor promotion with null default, requires an explicitly nullable type
+--FILE--
+<?php
+
+class Test {
+ public function __construct(public int $x = null) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use null as default value for parameter $x of type int in %s on line %d
diff --git a/Zend/tests/ctor_promotion_repeated_prop.phpt b/Zend/tests/ctor_promotion_repeated_prop.phpt
new file mode 100644
index 0000000000..6f4a9ffd02
--- /dev/null
+++ b/Zend/tests/ctor_promotion_repeated_prop.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Clash between promoted and explicit property
+--FILE--
+<?php
+
+class Test {
+ public $prop;
+
+ public function __construct(public $prop) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot redeclare Test::$prop in %s on line %d
diff --git a/Zend/tests/ctor_promotion_trait.phpt b/Zend/tests/ctor_promotion_trait.phpt
new file mode 100644
index 0000000000..4c109157ae
--- /dev/null
+++ b/Zend/tests/ctor_promotion_trait.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Constructor promotion can be used inside a trait
+--FILE--
+<?php
+
+trait Test {
+ public function __construct(public $prop) {}
+}
+
+class Test2 {
+ use Test;
+}
+
+var_dump(new Test2(42));
+
+?>
+--EXPECT--
+object(Test2)#1 (1) {
+ ["prop"]=>
+ int(42)
+}
diff --git a/Zend/tests/ctor_promotion_untyped_default.phpt b/Zend/tests/ctor_promotion_untyped_default.phpt
new file mode 100644
index 0000000000..50b4962aa4
--- /dev/null
+++ b/Zend/tests/ctor_promotion_untyped_default.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #79867: Promoted untyped properties should get null default value
+--FILE--
+<?php
+
+class A {
+ public function __construct(
+ public $untyped = 1,
+ public int $typed = 2,
+ ) {}
+}
+
+class B extends A {
+ public function __construct() {
+ // Missing parent::__construct() call,
+ // properties will not be initialized.
+ }
+}
+
+var_dump(new B);
+
+?>
+--EXPECT--
+object(B)#1 (1) {
+ ["untyped"]=>
+ NULL
+ ["typed"]=>
+ uninitialized(int)
+}
diff --git a/Zend/tests/ctor_promotion_variadic.phpt b/Zend/tests/ctor_promotion_variadic.phpt
new file mode 100644
index 0000000000..7e1e81cad8
--- /dev/null
+++ b/Zend/tests/ctor_promotion_variadic.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Cannot use constructor promotion with variadic parameter
+--FILE--
+<?php
+
+class Test {
+ public function __construct(public string ...$strings) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot declare variadic promoted property in %s on line %d
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/dead_array_type_inference.phpt b/Zend/tests/dead_array_type_inference.phpt
index 51f9b05816..f0f9d51ee2 100644
--- a/Zend/tests/dead_array_type_inference.phpt
+++ b/Zend/tests/dead_array_type_inference.phpt
@@ -13,6 +13,6 @@ test();
?>
--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
+Warning: foreach() argument must be of type array|object, null given in %s on line %d
diff --git a/Zend/tests/debug_backtrace_options.phpt b/Zend/tests/debug_backtrace_options.phpt
index a35eb64ff6..94842279ea 100644
--- a/Zend/tests/debug_backtrace_options.phpt
+++ b/Zend/tests/debug_backtrace_options.phpt
@@ -5,39 +5,39 @@ debug_backtrace options
function backtrace_print($opt = null)
{
- if(is_null($opt)) {
- print_r(debug_backtrace());
- } else {
- print_r(debug_backtrace($opt));
- }
+ if(is_null($opt)) {
+ print_r(debug_backtrace());
+ } else {
+ print_r(debug_backtrace($opt));
+ }
}
function doit($a, $b, $how)
{
- echo "==default\n";
- $how();
- echo "==true\n";
- $how(true);
- echo "==false\n";
- $how(false);
- echo "==DEBUG_BACKTRACE_PROVIDE_OBJECT\n";
- $how(DEBUG_BACKTRACE_PROVIDE_OBJECT);
- echo "==DEBUG_BACKTRACE_IGNORE_ARGS\n";
- $how(DEBUG_BACKTRACE_IGNORE_ARGS);
- echo "==both\n";
- $how(DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS);
+ echo "==default\n";
+ $how();
+ echo "==true\n";
+ $how(true);
+ echo "==false\n";
+ $how(false);
+ echo "==DEBUG_BACKTRACE_PROVIDE_OBJECT\n";
+ $how(DEBUG_BACKTRACE_PROVIDE_OBJECT);
+ echo "==DEBUG_BACKTRACE_IGNORE_ARGS\n";
+ $how(DEBUG_BACKTRACE_IGNORE_ARGS);
+ echo "==both\n";
+ $how(DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS);
}
class foo {
- protected function doCall($dowhat, $how)
- {
- $dowhat('a','b', $how);
- }
- static function statCall($dowhat, $how)
- {
- $obj = new self();
- $obj->doCall($dowhat, $how);
- }
+ protected function doCall($dowhat, $how)
+ {
+ $dowhat('a','b', $how);
+ }
+ static function statCall($dowhat, $how)
+ {
+ $obj = new self();
+ $obj->doCall($dowhat, $how);
+ }
}
foo::statCall("doit", "debug_print_backtrace");
foo::statCall("doit", "backtrace_print");
diff --git a/Zend/tests/debug_backtrace_with_include_and_this.phpt b/Zend/tests/debug_backtrace_with_include_and_this.phpt
index 5d58279eb5..1364432f5d 100644
--- a/Zend/tests/debug_backtrace_with_include_and_this.phpt
+++ b/Zend/tests/debug_backtrace_with_include_and_this.phpt
@@ -27,8 +27,9 @@ try {
} catch (CLException $e) {
echo $e."\n";
}
+?>
--EXPECTF--
-ERR#2: include(class://non.existent.Class): failed to open stream: "CLWrapper::stream_open" call failed @ include
+ERR#2: include(class://non.existent.Class): Failed to open stream: "CLWrapper::stream_open" call failed @ include
ERR#2: include(): Failed opening 'class://non.existent.Class' for inclusion (include_path='%s') @ include
Fatal error: Uncaught Exception: Failed loading class://non.existent.Class in %s
diff --git a/Zend/tests/debug_info-error-0.0.phpt b/Zend/tests/debug_info-error-0.0.phpt
index 1c8dfc8853..e3996e0f25 100644
--- a/Zend/tests/debug_info-error-0.0.phpt
+++ b/Zend/tests/debug_info-error-0.0.phpt
@@ -15,5 +15,6 @@ class C {
$c = new C(0.0);
var_dump($c);
+?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-0.0.php on line %d
diff --git a/Zend/tests/debug_info-error-0.phpt b/Zend/tests/debug_info-error-0.phpt
index 868ac2f75f..7dbac320a1 100644
--- a/Zend/tests/debug_info-error-0.phpt
+++ b/Zend/tests/debug_info-error-0.phpt
@@ -15,5 +15,6 @@ class C {
$c = new C(0);
var_dump($c);
+?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-0.php on line %d
diff --git a/Zend/tests/debug_info-error-1.0.phpt b/Zend/tests/debug_info-error-1.0.phpt
index 27611237bb..0213e9daad 100644
--- a/Zend/tests/debug_info-error-1.0.phpt
+++ b/Zend/tests/debug_info-error-1.0.phpt
@@ -15,5 +15,6 @@ class C {
$c = new C(1.0);
var_dump($c);
+?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-1.0.php on line %d
diff --git a/Zend/tests/debug_info-error-1.phpt b/Zend/tests/debug_info-error-1.phpt
index e2e9823ed4..a8e4644b49 100644
--- a/Zend/tests/debug_info-error-1.phpt
+++ b/Zend/tests/debug_info-error-1.phpt
@@ -15,5 +15,6 @@ class C {
$c = new C(1);
var_dump($c);
+?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-1.php on line %d
diff --git a/Zend/tests/debug_info-error-empty_str.phpt b/Zend/tests/debug_info-error-empty_str.phpt
index 72ab85d7d8..39f227cb96 100644
--- a/Zend/tests/debug_info-error-empty_str.phpt
+++ b/Zend/tests/debug_info-error-empty_str.phpt
@@ -15,5 +15,6 @@ class C {
$c = new C("");
var_dump($c);
+?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-empty_str.php on line %d
diff --git a/Zend/tests/debug_info-error-false.phpt b/Zend/tests/debug_info-error-false.phpt
index d6e19938af..bf18ed4d03 100644
--- a/Zend/tests/debug_info-error-false.phpt
+++ b/Zend/tests/debug_info-error-false.phpt
@@ -15,5 +15,6 @@ class C {
$c = new C(false);
var_dump($c);
+?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-false.php on line %d
diff --git a/Zend/tests/debug_info-error-object.phpt b/Zend/tests/debug_info-error-object.phpt
index 40737db2b6..e94c2dfb36 100644
--- a/Zend/tests/debug_info-error-object.phpt
+++ b/Zend/tests/debug_info-error-object.phpt
@@ -15,5 +15,6 @@ class C {
$c = new C(new stdClass);
var_dump($c);
+?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-object.php on line %d
diff --git a/Zend/tests/debug_info-error-resource.phpt b/Zend/tests/debug_info-error-resource.phpt
index e3bd542949..285ed72e33 100644
--- a/Zend/tests/debug_info-error-resource.phpt
+++ b/Zend/tests/debug_info-error-resource.phpt
@@ -17,5 +17,6 @@ class C {
$c = new C(fopen("data:text/plain,Foo", 'r'));
var_dump($c);
+?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-resource.php on line %d
diff --git a/Zend/tests/debug_info-error-str.phpt b/Zend/tests/debug_info-error-str.phpt
index aa16d5bf7c..daf0ad3b58 100644
--- a/Zend/tests/debug_info-error-str.phpt
+++ b/Zend/tests/debug_info-error-str.phpt
@@ -15,5 +15,6 @@ class C {
$c = new C("foo");
var_dump($c);
+?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-str.php on line %d
diff --git a/Zend/tests/debug_info-error-true.phpt b/Zend/tests/debug_info-error-true.phpt
index 2501e8a412..41a68c5c39 100644
--- a/Zend/tests/debug_info-error-true.phpt
+++ b/Zend/tests/debug_info-error-true.phpt
@@ -15,5 +15,6 @@ class C {
$c = new C(true);
var_dump($c);
+?>
--EXPECTF--
Fatal error: __debuginfo() must return an array in %s%eZend%etests%edebug_info-error-true.php on line %d
diff --git a/Zend/tests/debug_info.phpt b/Zend/tests/debug_info.phpt
index c82ddb2143..6f559eb40b 100644
--- a/Zend/tests/debug_info.phpt
+++ b/Zend/tests/debug_info.phpt
@@ -26,6 +26,7 @@ var_dump($f);
$b = new Bar;
var_dump($b);
+?>
--EXPECTF--
object(Foo)#%d (3) {
["a"]=>
diff --git a/Zend/tests/declare_006.phpt b/Zend/tests/declare_006.phpt
index 6d41c0d7d6..0c32927dc2 100644
--- a/Zend/tests/declare_006.phpt
+++ b/Zend/tests/declare_006.phpt
@@ -5,5 +5,6 @@ Use of non-literals in declare ticks values crashes compiler
declare(ticks = UNKNOWN_CONST) {
echo 'Done';
}
+?>
--EXPECTF--
Fatal error: declare(ticks) value must be a literal in %sdeclare_006.php on line 2
diff --git a/Zend/tests/decrement_001.phpt b/Zend/tests/decrement_001.phpt
index b768b5a8e5..6382491799 100644
--- a/Zend/tests/decrement_001.phpt
+++ b/Zend/tests/decrement_001.phpt
@@ -8,31 +8,36 @@ precision=14
<?php
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
foreach ($a as $var) {
- $var--;
- var_dump($var);
+ try {
+ $var--;
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ var_dump($var);
}
echo "Done\n";
?>
--EXPECTF--
+Cannot decrement array
array(3) {
[0]=>
int(1)
@@ -51,8 +56,10 @@ float(1.5)
NULL
bool(true)
bool(false)
+Cannot decrement stdClass
object(stdClass)#%d (0) {
}
+Cannot decrement array
array(0) {
}
float(-2147483649)
diff --git a/Zend/tests/decrement_001_64bit.phpt b/Zend/tests/decrement_001_64bit.phpt
index ac4f10d682..b776bc5dd3 100644
--- a/Zend/tests/decrement_001_64bit.phpt
+++ b/Zend/tests/decrement_001_64bit.phpt
@@ -8,31 +8,36 @@ precision=14
<?php
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- array(),
- -PHP_INT_MAX-1,
- (string)(-PHP_INT_MAX-1),
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ array(),
+ -PHP_INT_MAX-1,
+ (string)(-PHP_INT_MAX-1),
);
foreach ($a as $var) {
- $var--;
- var_dump($var);
+ try {
+ $var--;
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ var_dump($var);
}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
+Cannot decrement array
array(3) {
[0]=>
int(1)
@@ -51,10 +56,12 @@ float(1.5)
NULL
bool(true)
bool(false)
-object(stdClass)#%d (0) {
+Cannot decrement stdClass
+object(stdClass)#1 (0) {
}
+Cannot decrement array
array(0) {
}
-float(-9.2233720368548E+18)
-float(-9.2233720368548E+18)
+float(-9.223372036854776E+18)
+float(-9.223372036854776E+18)
Done
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_001.phpt b/Zend/tests/dereference_001.phpt
index 7873d624aa..84c5dfee12 100644
--- a/Zend/tests/dereference_001.phpt
+++ b/Zend/tests/dereference_001.phpt
@@ -5,38 +5,38 @@ Testing array dereference
error_reporting(E_ALL);
function a() {
- return array(1,array(5));
+ return array(1,array(5));
}
var_dump(a()[1][0]); // int(5)
function b() {
- return array();
+ return array();
}
-var_dump(b()[0]); // Notice: Undefined offset: 0
+var_dump(b()[0]); // Notice: Undefined array key 0
class foo {
- public $y = 1;
+ public $y = 1;
- public function test() {
- return array(array(array('foobar')));
- }
+ public function test() {
+ return array(array(array('foobar')));
+ }
}
function c() {
- return array(new foo);
+ return array(new foo);
}
var_dump(c()[0]->y); // int(1)
function d() {
- $obj = new foo;
- return $obj->test();
+ $obj = new foo;
+ return $obj->test();
}
var_dump(d()[0][0][0][3]); // string(1) "b"
function e() {
- $y = 'bar';
- $x = array('a' => 'foo', 'b' => $y);
- return $x;
+ $y = 'bar';
+ $x = array('a' => 'foo', 'b' => $y);
+ return $x;
}
var_dump(e()['b']); // string(3) "bar"
@@ -44,7 +44,7 @@ var_dump(e()['b']); // string(3) "bar"
--EXPECTF--
int(5)
-Notice: Undefined offset: 0 in %s on line %d
+Warning: Undefined array key 0 in %s on line %d
NULL
int(1)
string(1) "b"
diff --git a/Zend/tests/dereference_002.phpt b/Zend/tests/dereference_002.phpt
index 7290df7714..6c8339bb13 100644
--- a/Zend/tests/dereference_002.phpt
+++ b/Zend/tests/dereference_002.phpt
@@ -6,13 +6,13 @@ Testing array dereference on method calls
error_reporting(E_ALL);
class foo {
- public function bar() {
- $x = array();
- $x[] = 3;
- $x[] = array(1, 5);
- $x[] = new foo;
- return $x;
- }
+ public function bar() {
+ $x = array();
+ $x[] = 3;
+ $x[] = array(1, 5);
+ $x[] = new foo;
+ return $x;
+ }
}
$foo = new foo;
@@ -70,13 +70,13 @@ 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
+Warning: Undefined array key 4 in %s on line %d
NULL
-Notice: Undefined offset: 3 in %s on line %d
+Warning: Undefined array key 3 in %s on line %d
Fatal error: Uncaught Error: Call to a member function bar() on null in %s:%d
Stack trace:
diff --git a/Zend/tests/dereference_003.phpt b/Zend/tests/dereference_003.phpt
index 3a54875964..93bdb19684 100644
--- a/Zend/tests/dereference_003.phpt
+++ b/Zend/tests/dereference_003.phpt
@@ -6,24 +6,24 @@ Testing array dereference on method calls
error_reporting(E_ALL);
class foo {
- public $x = 2;
- public function a() {
- $x = array();
- $x[] = new foo;
- return $x;
- }
- public function b() {
- return array(1.2, array(new self));
- }
- public function c() {
- $a = array();
- $b = &$a;
- $b[] = true;
- return $a;
- }
- public function d() {
- return $this->b();
- }
+ public $x = 2;
+ public function a() {
+ $x = array();
+ $x[] = new foo;
+ return $x;
+ }
+ public function b() {
+ return array(1.2, array(new self));
+ }
+ public function c() {
+ $a = array();
+ $b = &$a;
+ $b[] = true;
+ return $a;
+ }
+ public function d() {
+ return $this->b();
+ }
}
$foo = new foo;
diff --git a/Zend/tests/dereference_004.phpt b/Zend/tests/dereference_004.phpt
index a77cf032ed..1ffe4bf388 100644
--- a/Zend/tests/dereference_004.phpt
+++ b/Zend/tests/dereference_004.phpt
@@ -6,15 +6,15 @@ Testing array dereference on __invoke() result
error_reporting(E_ALL);
class foo {
- public $x = array();
- public function __construct() {
- $h = array();
- $h[] = new stdclass;
- $this->x = $h;
- }
- public function __invoke() {
- return $this->x;
- }
+ public $x = array();
+ public function __construct() {
+ $h = array();
+ $h[] = new stdclass;
+ $this->x = $h;
+ }
+ public function __invoke() {
+ return $this->x;
+ }
}
diff --git a/Zend/tests/dereference_005.phpt b/Zend/tests/dereference_005.phpt
index cca87571cd..5dba2276e9 100644
--- a/Zend/tests/dereference_005.phpt
+++ b/Zend/tests/dereference_005.phpt
@@ -29,7 +29,7 @@ class obj implements arrayaccess {
}
function x() {
- return new obj;
+ return new obj;
}
var_dump(x()['two']);
diff --git a/Zend/tests/dereference_006.phpt b/Zend/tests/dereference_006.phpt
index 61a07353a4..694ded85b7 100644
--- a/Zend/tests/dereference_006.phpt
+++ b/Zend/tests/dereference_006.phpt
@@ -6,7 +6,7 @@ Testing array dereference and references
error_reporting(E_ALL);
function &foo(&$foo) {
- return $foo;
+ return $foo;
}
$a = array(1);
diff --git a/Zend/tests/dereference_007.phpt b/Zend/tests/dereference_007.phpt
index e7df6a422d..90fed2cfb8 100644
--- a/Zend/tests/dereference_007.phpt
+++ b/Zend/tests/dereference_007.phpt
@@ -6,19 +6,19 @@ Trying to write on method return
error_reporting(E_ALL);
class foo {
- public $x = array();
+ public $x = array();
- public function b() {
- return $this->x;
- }
+ public function b() {
+ return $this->x;
+ }
- public function c() {
- return $x;
- }
+ public function c() {
+ return $x;
+ }
- static public function d() {
+ static public function d() {
- }
+ }
}
$foo = new foo;
@@ -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_008.phpt b/Zend/tests/dereference_008.phpt
index c615b9cd85..973fd24ffd 100644
--- a/Zend/tests/dereference_008.phpt
+++ b/Zend/tests/dereference_008.phpt
@@ -6,11 +6,11 @@ Testing array dereference with dynamic method name and references
error_reporting(E_ALL);
class foo {
- public $x = array(1);
+ public $x = array(1);
- public function &b() {
- return $this->x;
- }
+ public function &b() {
+ return $this->x;
+ }
}
$foo = new foo;
diff --git a/Zend/tests/dereference_009.phpt b/Zend/tests/dereference_009.phpt
index e579c44bae..5cf36a4758 100644
--- a/Zend/tests/dereference_009.phpt
+++ b/Zend/tests/dereference_009.phpt
@@ -8,7 +8,7 @@ error_reporting(E_ALL);
$a = array();
function &a() {
- return $GLOBALS['a'];
+ return $GLOBALS['a'];
}
var_dump($h =& a());
diff --git a/Zend/tests/dereference_010.phpt b/Zend/tests/dereference_010.phpt
index c63f6acaf9..191da8f348 100644
--- a/Zend/tests/dereference_010.phpt
+++ b/Zend/tests/dereference_010.phpt
@@ -6,7 +6,7 @@ Testing dereference in non-array values
error_reporting(E_ALL);
function a() {
- return 1;
+ return 1;
}
$a = 1;
@@ -14,17 +14,17 @@ var_dump($a[1]);
var_dump(a()[1]);
function b() {
- return new stdClass;
+ return new stdClass;
}
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_011.phpt b/Zend/tests/dereference_011.phpt
index 43fec9b92a..26c7771824 100644
--- a/Zend/tests/dereference_011.phpt
+++ b/Zend/tests/dereference_011.phpt
@@ -6,11 +6,11 @@ Testing array dereference with chaining
error_reporting(E_ALL);
class foo {
- public $arr;
+ public $arr;
- public function &a() {
- return $this->arr;
- }
+ public function &a() {
+ return $this->arr;
+ }
}
$foo = new foo;
diff --git a/Zend/tests/dereference_012.phpt b/Zend/tests/dereference_012.phpt
index ab70957a0a..7c1501e73f 100644
--- a/Zend/tests/dereference_012.phpt
+++ b/Zend/tests/dereference_012.phpt
@@ -4,18 +4,18 @@ Testing array dereferencing on return of a method with and without reference
<?php
class foo {
- static $x = array();
-
- public function &a() {
- self::$x = array(1, 2, 3);
- return self::$x;
- }
-
- public function b() {
- $x = array(1);
- $x[] = 2;
- return $x;
- }
+ static $x = array();
+
+ public function &a() {
+ self::$x = array(1, 2, 3);
+ return self::$x;
+ }
+
+ public function b() {
+ $x = array(1);
+ $x[] = 2;
+ return $x;
+ }
}
$foo = new foo;
diff --git a/Zend/tests/dereference_013.phpt b/Zend/tests/dereference_013.phpt
index 139cd480b7..21bbb91418 100644
--- a/Zend/tests/dereference_013.phpt
+++ b/Zend/tests/dereference_013.phpt
@@ -6,14 +6,14 @@ Testing array dereferencing on array returned from __call method
error_reporting(E_ALL);
class foo {
- public $x = array(2);
-
- public function __call($x, $y) {
- if (count($this->x) == 1) {
- $this->x[] = $y[0];
- }
- return $this->x;
- }
+ public $x = array(2);
+
+ public function __call($x, $y) {
+ if (count($this->x) == 1) {
+ $this->x[] = $y[0];
+ }
+ return $this->x;
+ }
}
$foo = new foo;
@@ -34,5 +34,5 @@ array(1) {
int(1)
}
-Notice: Undefined offset: %d in %s on line %d
+Warning: Undefined array key 2 in %s on line %d
NULL
diff --git a/Zend/tests/dereference_014.phpt b/Zend/tests/dereference_014.phpt
index 189dca7a38..35affdf3ca 100644
--- a/Zend/tests/dereference_014.phpt
+++ b/Zend/tests/dereference_014.phpt
@@ -6,16 +6,16 @@ Trying to create an object from dereferencing uninitialized variable
error_reporting(E_ALL);
class foo {
- public $x;
- static public $y;
+ public $x;
+ static public $y;
- public function a() {
- return $this->x;
- }
+ public function a() {
+ return $this->x;
+ }
- static public function b() {
- return self::$y;
- }
+ static public function b() {
+ return self::$y;
+ }
}
$foo = new foo;
@@ -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: Attempt to read property "a" on 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
-Notice: Trying to get property 'b' of non-object in %s on line %d
+Warning: Attempt to read property "b" on null in %s on line %d
NULL
diff --git a/Zend/tests/die_string_cast_exception.phpt b/Zend/tests/die_string_cast_exception.phpt
new file mode 100644
index 0000000000..9893c3389f
--- /dev/null
+++ b/Zend/tests/die_string_cast_exception.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #79777: String cast exception during die should be handled gracefully
+--FILE--
+<?php
+
+die(new stdClass);
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/dim_assign_001.phpt b/Zend/tests/dim_assign_001.phpt
new file mode 100644
index 0000000000..ca0654a4c0
--- /dev/null
+++ b/Zend/tests/dim_assign_001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT - Assigning to arrays using string key which parses to an integer
+--FILE--
+<?php
+/* We are going to store a value in an array, using the key "1"
+ * PHP should always convert such strings to integers when storing or retrieving
+ * values from an array
+ *
+ * We'll do it in a loop, so that if JIT is enabled, the code will be JIT'd
+ * (Because this test was originally added as a regression test for a JIT bug)
+ *
+ * Also, the test will do this in a way which guarantees PHP won't be able to
+ * predict whether the (string) key will be a numeric string or not */
+$fp = fopen(realpath(__DIR__ . '/dim_assign_001.txt'), 'r+');
+$array = array();
+while ($line = fgets($fp, 256)) {
+ sscanf($line, '%x', $char);
+ $char = chr($char);
+ $array[$char] = "Values can be stored correctly using numeric string keys";
+}
+var_dump($array['1']);
+?>
+--EXPECT--
+string(56) "Values can be stored correctly using numeric string keys"
diff --git a/Zend/tests/dim_assign_001.txt b/Zend/tests/dim_assign_001.txt
new file mode 100644
index 0000000000..f14f5c0cbe
--- /dev/null
+++ b/Zend/tests/dim_assign_001.txt
@@ -0,0 +1,2 @@
+0x30
+0x31
diff --git a/Zend/tests/div_001.phpt b/Zend/tests/div_001.phpt
index 051ed3f733..11cf897541 100644
--- a/Zend/tests/div_001.phpt
+++ b/Zend/tests/div_001.phpt
@@ -26,7 +26,7 @@ var_dump($c);
echo "Done\n";
?>
--EXPECT--
-float(394758.39454545)
-float(394758.39454545)
-float(394758.39454545)
+float(394758.39454545453)
+float(394758.39454545453)
+float(394758.39454545453)
Done
diff --git a/Zend/tests/div_002.phpt b/Zend/tests/div_002.phpt
index be7b38e5b2..22ed3f1393 100644
--- a/Zend/tests/div_002.phpt
+++ b/Zend/tests/div_002.phpt
@@ -7,9 +7,9 @@ $a = array(1,2,3);
$b = array(1);
try {
- var_dump($a / $b);
+ var_dump($a / $b);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$c = $a / $b;
@@ -18,9 +18,9 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types
+Exception: Unsupported operand types: array / array
-Fatal error: Uncaught Error: Unsupported operand types in %s:%d
+Fatal error: Uncaught TypeError: Unsupported operand types: array / array in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/div_by_zero_in_static.phpt b/Zend/tests/div_by_zero_in_static.phpt
new file mode 100644
index 0000000000..2d7a908e73
--- /dev/null
+++ b/Zend/tests/div_by_zero_in_static.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Division by zero in static
+--FILE--
+<?php
+static $a = 1/0;
+?>
+--EXPECTF--
+Fatal error: Uncaught DivisionByZeroError: Division by zero in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/double_to_string.phpt b/Zend/tests/double_to_string.phpt
index a778017a63..808024b0e5 100644
--- a/Zend/tests/double_to_string.phpt
+++ b/Zend/tests/double_to_string.phpt
@@ -8,26 +8,26 @@ precision=14
<?php
$doubles = array(
- 290000000000000000,
- 290000000000000,
- 29000000000000,
- 29000000000000.123123,
- 29000000000000.7123123,
- 29000.7123123,
- 239234242.7123123,
- 0.12345678901234567890,
- 10000000000000,
- 100000000000000,
- 1000000000000000001,
- 100000000000001,
- 10000000000,
- 999999999999999,
- 9999999999999999,
- (float)0
- );
+ 290000000000000000,
+ 290000000000000,
+ 29000000000000,
+ 29000000000000.123123,
+ 29000000000000.7123123,
+ 29000.7123123,
+ 239234242.7123123,
+ 0.12345678901234567890,
+ 10000000000000,
+ 100000000000000,
+ 1000000000000000001,
+ 100000000000001,
+ 10000000000,
+ 999999999999999,
+ 9999999999999999,
+ (float)0
+ );
foreach ($doubles as $d) {
- var_dump((string)$d);
+ var_dump((string)$d);
}
echo "Done\n";
diff --git a/Zend/tests/dval_to_lval_32.phpt b/Zend/tests/dval_to_lval_32.phpt
index f2acc39f51..89acf9076a 100644
--- a/Zend/tests/dval_to_lval_32.phpt
+++ b/Zend/tests/dval_to_lval_32.phpt
@@ -3,24 +3,24 @@ zend_dval_to_lval preserves low bits (32 bit long)
--SKIPIF--
<?php
if (PHP_INT_SIZE != 4)
- die("skip for machines with 32-bit longs");
+ die("skip for machines with 32-bit longs");
?>
--FILE--
<?php
- /* test doubles around -4e21 */
- $values = [
- -4000000000000001048576.,
- -4000000000000000524288.,
- -4000000000000000000000.,
- -3999999999999999475712.,
- -3999999999999998951424.,
- ];
- /* see if we're rounding negative numbers right */
- $values[] = -2147483649.8;
+ /* test doubles around -4e21 */
+ $values = [
+ -4000000000000001048576.,
+ -4000000000000000524288.,
+ -4000000000000000000000.,
+ -3999999999999999475712.,
+ -3999999999999998951424.,
+ ];
+ /* see if we're rounding negative numbers right */
+ $values[] = -2147483649.8;
- foreach ($values as $v) {
- var_dump((int)$v);
- }
+ foreach ($values as $v) {
+ var_dump((int)$v);
+ }
?>
--EXPECT--
diff --git a/Zend/tests/dval_to_lval_64.phpt b/Zend/tests/dval_to_lval_64.phpt
index da7f56d81c..b54f861bf5 100644
--- a/Zend/tests/dval_to_lval_64.phpt
+++ b/Zend/tests/dval_to_lval_64.phpt
@@ -3,22 +3,22 @@ zend_dval_to_lval preserves low bits (64 bit long)
--SKIPIF--
<?php
if (PHP_INT_SIZE != 8)
- die("skip for machines with 64-bit longs");
+ die("skip for machines with 64-bit longs");
?>
--FILE--
<?php
- /* test doubles around -4e21 */
- $values = [
- -4000000000000001048576.,
- -4000000000000000524288.,
- -4000000000000000000000.,
- -3999999999999999475712.,
- -3999999999999998951424.,
- ];
+ /* test doubles around -4e21 */
+ $values = [
+ -4000000000000001048576.,
+ -4000000000000000524288.,
+ -4000000000000000000000.,
+ -3999999999999999475712.,
+ -3999999999999998951424.,
+ ];
- foreach ($values as $v) {
- var_dump((int)$v);
- }
+ foreach ($values as $v) {
+ var_dump((int)$v);
+ }
?>
--EXPECT--
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_002.phpt b/Zend/tests/dynamic_call_002.phpt
index a090862258..2fcb8702eb 100644
--- a/Zend/tests/dynamic_call_002.phpt
+++ b/Zend/tests/dynamic_call_002.phpt
@@ -9,7 +9,7 @@ $a::$a();
?>
--EXPECTF--
-Fatal error: Uncaught Error: Function name must be a string in %s:%d
+Fatal error: Uncaught Error: Method name must be a string in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/dynamic_call_003.phpt b/Zend/tests/dynamic_call_003.phpt
index a400e33596..c19b68eccc 100644
--- a/Zend/tests/dynamic_call_003.phpt
+++ b/Zend/tests/dynamic_call_003.phpt
@@ -10,7 +10,7 @@ $a::$b();
?>
--EXPECTF--
-Fatal error: Uncaught Error: Function name must be a string in %s:%d
+Fatal error: Uncaught Error: Method name must be a string 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..e29671f711 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/dynamic_call_freeing.phpt b/Zend/tests/dynamic_call_freeing.phpt
index d124009295..1bba3ebf6b 100644
--- a/Zend/tests/dynamic_call_freeing.phpt
+++ b/Zend/tests/dynamic_call_freeing.phpt
@@ -24,5 +24,5 @@ try {
?>
--EXPECT--
Call to undefined function foobar()
-Function name must be a string
-Function name must be a string
+Array callback must have exactly two elements
+Object of type stdClass is not callable
diff --git a/Zend/tests/dynamic_call_non_static.phpt b/Zend/tests/dynamic_call_non_static.phpt
new file mode 100644
index 0000000000..f73d29a131
--- /dev/null
+++ b/Zend/tests/dynamic_call_non_static.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Dynamic static call of non-static method
+--FILE--
+<?php
+class Foo {
+ function test1() {
+ $method = ['Foo', 'bar'];
+ $method();
+ }
+ function test2() {
+ $method = 'Foo::bar';
+ $method();
+ }
+ function __call($name, $args) {}
+}
+$x = new Foo;
+try {
+ $x->test1();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $x->test2();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+Non-static method Foo::bar() cannot be called statically
+Non-static method Foo::bar() cannot be called statically
diff --git a/Zend/tests/dynamic_prop_name_leak.phpt b/Zend/tests/dynamic_prop_name_leak.phpt
new file mode 100644
index 0000000000..4f73022802
--- /dev/null
+++ b/Zend/tests/dynamic_prop_name_leak.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Dynamic prop name with type conversion in reference position should not leak
+--FILE--
+<?php
+$obj = new stdClass;
+$name = 0.0;
+$ref =& $obj->$name;
+var_dump($obj);
+?>
+--EXPECT--
+object(stdClass)#1 (1) {
+ ["0"]=>
+ &NULL
+}
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/empty_with_expr.phpt b/Zend/tests/empty_with_expr.phpt
index 582eb3d2d0..d424e10d18 100644
--- a/Zend/tests/empty_with_expr.phpt
+++ b/Zend/tests/empty_with_expr.phpt
@@ -19,6 +19,7 @@ var_dump(empty("string"));
var_dump(empty(""));
var_dump(empty(true));
var_dump(empty(false));
+?>
--EXPECT--
bool(true)
bool(false)
diff --git a/Zend/tests/entry_block_with_predecessors.phpt b/Zend/tests/entry_block_with_predecessors.phpt
index ffc3147f1c..ee1dc16b78 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_001.phpt b/Zend/tests/errmsg_001.phpt
index c17764cdec..e629f19c40 100644
--- a/Zend/tests/errmsg_001.phpt
+++ b/Zend/tests/errmsg_001.phpt
@@ -7,7 +7,7 @@ abstract class test {
}
class Impl extends Test {
- function Foo();
+ function Foo();
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_002.phpt b/Zend/tests/errmsg_002.phpt
index d1c4cb893f..b00a850fad 100644
--- a/Zend/tests/errmsg_002.phpt
+++ b/Zend/tests/errmsg_002.phpt
@@ -4,8 +4,8 @@ errmsg: function cannot be declared private
<?php
abstract class test {
- abstract private function foo() {
- }
+ abstract private function foo() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_003.phpt b/Zend/tests/errmsg_003.phpt
index 8daa66ae10..d13b4ccfbd 100644
--- a/Zend/tests/errmsg_003.phpt
+++ b/Zend/tests/errmsg_003.phpt
@@ -4,10 +4,10 @@ errmsg: cannot reassign $this (by ref)
<?php
class test {
- function foo() {
- $a = new test;
- $this = &$a;
- }
+ function foo() {
+ $a = new test;
+ $this = &$a;
+ }
}
$t = new test;
diff --git a/Zend/tests/errmsg_004.phpt b/Zend/tests/errmsg_004.phpt
index e322b66429..7e71b41087 100644
--- a/Zend/tests/errmsg_004.phpt
+++ b/Zend/tests/errmsg_004.phpt
@@ -4,7 +4,7 @@ errmsg: can't use function return value in write context
<?php
function foo() {
- return "blah";
+ return "blah";
}
foo() = 1;
diff --git a/Zend/tests/errmsg_005.phpt b/Zend/tests/errmsg_005.phpt
index a7a2dc803c..6089a771f4 100644
--- a/Zend/tests/errmsg_005.phpt
+++ b/Zend/tests/errmsg_005.phpt
@@ -4,9 +4,9 @@ errmsg: can't use method return value in write context
<?php
class test {
- function foo() {
- return "blah";
- }
+ function foo() {
+ return "blah";
+ }
}
$t = new test;
diff --git a/Zend/tests/errmsg_009.phpt b/Zend/tests/errmsg_009.phpt
index c65b40e0d5..6f8acd6c7b 100644
--- a/Zend/tests/errmsg_009.phpt
+++ b/Zend/tests/errmsg_009.phpt
@@ -4,7 +4,7 @@ errmsg: multiple access type modifiers are not allowed (properties)
<?php
class test {
- public private $var;
+ public private $var;
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_010.phpt b/Zend/tests/errmsg_010.phpt
index b283d2ce65..f93cd58be8 100644
--- a/Zend/tests/errmsg_010.phpt
+++ b/Zend/tests/errmsg_010.phpt
@@ -4,7 +4,7 @@ errmsg: multiple access type modifiers are not allowed (methods)
<?php
class test {
- private protected function foo() {}
+ private protected function foo() {}
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_011.phpt b/Zend/tests/errmsg_011.phpt
index 5333f3b23c..ac29c6e081 100644
--- a/Zend/tests/errmsg_011.phpt
+++ b/Zend/tests/errmsg_011.phpt
@@ -5,8 +5,8 @@ errmsg: cannot redeclare (method)
class test {
- function foo() {}
- function foo() {}
+ function foo() {}
+ function foo() {}
}
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..74c7bc2e8e 100644
--- a/Zend/tests/errmsg_013.phpt
+++ b/Zend/tests/errmsg_013.phpt
@@ -1,14 +1,14 @@
--TEST--
-errmsg: default value for parameters with array type can only be an array or NULL
+errmsg: default value for parameters with array type can only be an array or null
--FILE--
<?php
class test {
- function foo(array $a = "s") {
- }
+ function foo(array $a = "s") {
+ }
}
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_015.phpt b/Zend/tests/errmsg_015.phpt
index 948dee2f76..429a852cdf 100644
--- a/Zend/tests/errmsg_015.phpt
+++ b/Zend/tests/errmsg_015.phpt
@@ -4,11 +4,11 @@ errmsg: __clone() cannot accept any arguments
<?php
class test {
- function __clone($var) {
- }
+ function __clone($var) {
+ }
}
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Method test::__clone() cannot accept any arguments in %s on line %d
+Fatal error: Method test::__clone() cannot take arguments in %s on line %d
diff --git a/Zend/tests/errmsg_016.phpt b/Zend/tests/errmsg_016.phpt
index 05e10b41ab..4b57023230 100644
--- a/Zend/tests/errmsg_016.phpt
+++ b/Zend/tests/errmsg_016.phpt
@@ -4,8 +4,8 @@ errmsg: __isset() must take exactly 1 argument
<?php
class test {
- function __isset() {
- }
+ function __isset() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_017.phpt b/Zend/tests/errmsg_017.phpt
index ba55c1a2c5..386465d531 100644
--- a/Zend/tests/errmsg_017.phpt
+++ b/Zend/tests/errmsg_017.phpt
@@ -4,8 +4,8 @@ errmsg: __unset() must take exactly 1 argument
<?php
class test {
- function __unset() {
- }
+ function __unset() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_018.phpt b/Zend/tests/errmsg_018.phpt
index fd34c8031e..13a0cf4511 100644
--- a/Zend/tests/errmsg_018.phpt
+++ b/Zend/tests/errmsg_018.phpt
@@ -4,7 +4,7 @@ errmsg: static abstract function
<?php
class test {
- static abstract function foo ();
+ static abstract function foo ();
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_019.phpt b/Zend/tests/errmsg_019.phpt
index bb8ebff5ab..6f7780da0d 100644
--- a/Zend/tests/errmsg_019.phpt
+++ b/Zend/tests/errmsg_019.phpt
@@ -4,11 +4,11 @@ errmsg: __destruct() cannot take arguments
<?php
class test {
- function __destruct($var) {
- }
+ function __destruct($var) {
+ }
}
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Destructor test::__destruct() cannot take arguments in %s on line %d
+Fatal error: Method test::__destruct() cannot take arguments in %s on line %d
diff --git a/Zend/tests/errmsg_020.phpt b/Zend/tests/errmsg_020.phpt
index 636e29d01f..4a7c326d05 100644
--- a/Zend/tests/errmsg_020.phpt
+++ b/Zend/tests/errmsg_020.phpt
@@ -5,10 +5,12 @@ disable_functions=phpinfo
--FILE--
<?php
-phpinfo();
+try {
+ phpinfo();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "Done\n";
?>
---EXPECTF--
-Warning: phpinfo() has been disabled for security reasons in %s on line %d
-Done
+--EXPECT--
+Call to undefined function phpinfo()
diff --git a/Zend/tests/errmsg_022.phpt b/Zend/tests/errmsg_022.phpt
index aba8d750c6..3d1eaf3e99 100644
--- a/Zend/tests/errmsg_022.phpt
+++ b/Zend/tests/errmsg_022.phpt
@@ -11,4 +11,7 @@ foo(1);
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Only variables can be passed by reference in %s on line %d
+Fatal error: Uncaught Error: foo(): Argument #1 ($var) cannot be passed by reference in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/errmsg_023.phpt b/Zend/tests/errmsg_023.phpt
index 4532e2ad3a..551a7c5305 100644
--- a/Zend/tests/errmsg_023.phpt
+++ b/Zend/tests/errmsg_023.phpt
@@ -4,11 +4,11 @@ errmsg: access level must be the same or weaker
<?php
class test1 {
- protected $var;
+ protected $var;
}
class test extends test1 {
- private $var;
+ private $var;
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_024.phpt b/Zend/tests/errmsg_024.phpt
index 0755d2b75c..275ed47a99 100644
--- a/Zend/tests/errmsg_024.phpt
+++ b/Zend/tests/errmsg_024.phpt
@@ -4,11 +4,11 @@ No more errmsg: can now change initial value of property
<?php
class test1 {
- static protected $var = 1;
+ static protected $var = 1;
}
class test extends test1 {
- static $var = 10;
+ static $var = 10;
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_025.phpt b/Zend/tests/errmsg_025.phpt
index 014b409479..d003ec859d 100644
--- a/Zend/tests/errmsg_025.phpt
+++ b/Zend/tests/errmsg_025.phpt
@@ -4,11 +4,11 @@ errmsg: cannot inherit previously inherited constant
<?php
interface test1 {
- const FOO = 10;
+ const FOO = 10;
}
interface test2 {
- const FOO = 10;
+ const FOO = 10;
}
class test implements test1, test2 {
diff --git a/Zend/tests/errmsg_027.phpt b/Zend/tests/errmsg_027.phpt
index b2cd4e1655..3d96ec27b4 100644
--- a/Zend/tests/errmsg_027.phpt
+++ b/Zend/tests/errmsg_027.phpt
@@ -4,10 +4,10 @@ errmsg: class declarations may not be nested
<?php
class test {
- function foo() {
- class test2 {
- }
- }
+ function foo() {
+ class test2 {
+ }
+ }
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_030.phpt b/Zend/tests/errmsg_030.phpt
index c0d42263c3..589965cf08 100644
--- a/Zend/tests/errmsg_030.phpt
+++ b/Zend/tests/errmsg_030.phpt
@@ -9,4 +9,4 @@ class test extends self {
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Cannot use 'self' as class name as it is reserved in %s on line %d
+Fatal error: Cannot use 'self' as class name, as it is reserved in %s on line %d
diff --git a/Zend/tests/errmsg_031.phpt b/Zend/tests/errmsg_031.phpt
index c847a26e64..ed1d0bec2d 100644
--- a/Zend/tests/errmsg_031.phpt
+++ b/Zend/tests/errmsg_031.phpt
@@ -9,4 +9,4 @@ class test extends parent {
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Cannot use 'parent' as class name as it is reserved in %s on line %d
+Fatal error: Cannot use 'parent' as class name, as it is reserved in %s on line %d
diff --git a/Zend/tests/errmsg_032.phpt b/Zend/tests/errmsg_032.phpt
index f21e269a89..401f7073ea 100644
--- a/Zend/tests/errmsg_032.phpt
+++ b/Zend/tests/errmsg_032.phpt
@@ -5,11 +5,11 @@ errmsg: __construct() cannot be static
class test {
- static function __construct() {
- }
+ static function __construct() {
+ }
}
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Constructor test::__construct() cannot be static in %s on line %d
+Fatal error: Method test::__construct() cannot be static in %s on line %d
diff --git a/Zend/tests/errmsg_033.phpt b/Zend/tests/errmsg_033.phpt
index e5f36912b0..f71b17ce16 100644
--- a/Zend/tests/errmsg_033.phpt
+++ b/Zend/tests/errmsg_033.phpt
@@ -5,11 +5,11 @@ errmsg: __destruct() cannot be static
class test {
- static function __destruct() {
- }
+ static function __destruct() {
+ }
}
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Destructor test::__destruct() cannot be static in %s on line %d
+Fatal error: Method test::__destruct() cannot be static in %s on line %d
diff --git a/Zend/tests/errmsg_034.phpt b/Zend/tests/errmsg_034.phpt
index a8bfc80b9a..97a7f1c2a6 100644
--- a/Zend/tests/errmsg_034.phpt
+++ b/Zend/tests/errmsg_034.phpt
@@ -5,11 +5,11 @@ errmsg: __clone() cannot be static
class test {
- static function __clone() {
- }
+ static function __clone() {
+ }
}
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Clone method test::__clone() cannot be static in %s on line %d
+Fatal error: Method test::__clone() cannot be static in %s on line %d
diff --git a/Zend/tests/errmsg_035.phpt b/Zend/tests/errmsg_035.phpt
index e8fa8da8e8..140e3e9cf4 100644
--- a/Zend/tests/errmsg_035.phpt
+++ b/Zend/tests/errmsg_035.phpt
@@ -9,4 +9,4 @@ class test implements self {
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Cannot use 'self' as interface name as it is reserved in %s on line %d
+Fatal error: Cannot use 'self' as interface name, as it is reserved in %s on line %d
diff --git a/Zend/tests/errmsg_036.phpt b/Zend/tests/errmsg_036.phpt
index 4f98f384d7..33c6bca1d6 100644
--- a/Zend/tests/errmsg_036.phpt
+++ b/Zend/tests/errmsg_036.phpt
@@ -9,4 +9,4 @@ class test implements parent {
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Cannot use 'parent' as interface name as it is reserved in %s on line %d
+Fatal error: Cannot use 'parent' as interface name, as it is reserved in %s on line %d
diff --git a/Zend/tests/errmsg_037.phpt b/Zend/tests/errmsg_037.phpt
index b67ce0b5d0..f15fea89f3 100644
--- a/Zend/tests/errmsg_037.phpt
+++ b/Zend/tests/errmsg_037.phpt
@@ -4,7 +4,7 @@ errmsg: properties cannot be abstract
<?php
class test {
- abstract $var = 1;
+ abstract $var = 1;
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_038.phpt b/Zend/tests/errmsg_038.phpt
index 6312ef64ce..d5ae50ded0 100644
--- a/Zend/tests/errmsg_038.phpt
+++ b/Zend/tests/errmsg_038.phpt
@@ -4,7 +4,7 @@ errmsg: properties cannot be final
<?php
class test {
- final $var = 1;
+ final $var = 1;
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_039.phpt b/Zend/tests/errmsg_039.phpt
index 5371ba56c6..cc07106f5e 100644
--- a/Zend/tests/errmsg_039.phpt
+++ b/Zend/tests/errmsg_039.phpt
@@ -4,8 +4,8 @@ errmsg: cannot redeclare property
<?php
class test {
- var $var;
- var $var;
+ var $var;
+ var $var;
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_040.phpt b/Zend/tests/errmsg_040.phpt
index d8ebc67bf6..6715eab1c9 100644
--- a/Zend/tests/errmsg_040.phpt
+++ b/Zend/tests/errmsg_040.phpt
@@ -4,7 +4,7 @@ errmsg: arrays are not allowed in class constants
<?php
class test {
- const TEST = array(1,2,3);
+ const TEST = array(1,2,3);
}
var_dump(test::TEST);
echo "Done\n";
diff --git a/Zend/tests/errmsg_045.phpt b/Zend/tests/errmsg_045.phpt
index fbb2528e28..4a75cf5df4 100644
--- a/Zend/tests/errmsg_045.phpt
+++ b/Zend/tests/errmsg_045.phpt
@@ -4,17 +4,17 @@ Error message in error handler during compilation
<?php
set_error_handler(function($_, $msg, $file) {
- var_dump($msg, $file);
- echo $undefined;
+ var_dump($msg, $file);
+ echo $undefined;
});
/* 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(%d) "The magic method A::__invoke() must have public visibility"
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_reporting01.phpt b/Zend/tests/error_reporting01.phpt
index 75c4189ce2..97524b43fd 100644
--- a/Zend/tests/error_reporting01.phpt
+++ b/Zend/tests/error_reporting01.phpt
@@ -9,11 +9,11 @@ function foo($arg) {
}
function bar() {
- throw new Exception("test");
+ throw new Exception("test");
}
try {
- @foo(@bar());
+ @foo(@bar());
} catch (Exception $e) {
}
diff --git a/Zend/tests/error_reporting02.phpt b/Zend/tests/error_reporting02.phpt
index c76c5b54c8..5caf265d76 100644
--- a/Zend/tests/error_reporting02.phpt
+++ b/Zend/tests/error_reporting02.phpt
@@ -9,12 +9,12 @@ function foo($arg) {
}
function bar() {
- error_reporting(E_ALL);
- throw new Exception("test");
+ error_reporting(E_ALL);
+ throw new Exception("test");
}
try {
- @foo(@bar());
+ @foo(@bar());
} catch (Exception $e) {
}
diff --git a/Zend/tests/error_reporting03.phpt b/Zend/tests/error_reporting03.phpt
index f344e9557b..d6c442bebb 100644
--- a/Zend/tests/error_reporting03.phpt
+++ b/Zend/tests/error_reporting03.phpt
@@ -6,22 +6,22 @@ testing @ and error_reporting - 3
error_reporting(E_ALL & ~E_DEPRECATED);
function foo($arg) {
- echo @$nonex_foo;
+ echo @$nonex_foo;
}
function bar() {
- echo @$nonex_bar;
- throw new Exception("test");
+ echo @$nonex_bar;
+ throw new Exception("test");
}
function foo1() {
- echo $undef1;
- error_reporting(E_ALL);
- echo $undef2;
+ echo $undef1;
+ error_reporting(E_ALL);
+ echo $undef2;
}
try {
- @foo(@bar(@foo1()));
+ @foo(@bar(@foo1()));
} catch (Exception $e) {
}
@@ -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..f53565de9e 100644
--- a/Zend/tests/error_reporting04.phpt
+++ b/Zend/tests/error_reporting04.phpt
@@ -6,8 +6,8 @@ testing @ and error_reporting - 4
error_reporting(E_ALL & ~E_DEPRECATED);
function foo() {
- echo $undef;
- error_reporting(E_ALL);
+ echo $undef;
+ error_reporting(E_ALL);
}
@@ -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..9ffd3971a1 100644
--- a/Zend/tests/error_reporting05.phpt
+++ b/Zend/tests/error_reporting05.phpt
@@ -6,12 +6,12 @@ testing @ and error_reporting - 5
error_reporting(E_ALL);
class test {
- function __get($name) {
- return $undef_name;
- }
- function __set($name, $value) {
- return $undef_value;
- }
+ function __get($name) {
+ return $undef_name;
+ }
+ function __set($name, $value) {
+ return $undef_value;
+ }
}
$test = new test;
@@ -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_reporting06.phpt b/Zend/tests/error_reporting06.phpt
index 8f286f75ae..809c1d614b 100644
--- a/Zend/tests/error_reporting06.phpt
+++ b/Zend/tests/error_reporting06.phpt
@@ -12,12 +12,12 @@ function foo2($arg) {
}
function foo3() {
- echo $undef3;
- throw new Exception("test");
+ echo $undef3;
+ throw new Exception("test");
}
try {
- @foo1(@foo2(@foo3()));
+ @foo1(@foo2(@foo3()));
} catch (Exception $e) {
}
diff --git a/Zend/tests/error_reporting07.phpt b/Zend/tests/error_reporting07.phpt
index 84cf6264b9..8b57847b0b 100644
--- a/Zend/tests/error_reporting07.phpt
+++ b/Zend/tests/error_reporting07.phpt
@@ -12,12 +12,12 @@ function foo2($arg) {
}
function foo3() {
- echo $undef3;
- throw new Exception("test");
+ echo $undef3;
+ throw new Exception("test");
}
try {
- @error_reporting(@foo1(@foo2(@foo3())));
+ @error_reporting(@foo1(@foo2(@foo3())));
} catch (Exception $e) {
}
diff --git a/Zend/tests/error_reporting08.phpt b/Zend/tests/error_reporting08.phpt
index 32cb6b8d16..2450abfc67 100644
--- a/Zend/tests/error_reporting08.phpt
+++ b/Zend/tests/error_reporting08.phpt
@@ -12,13 +12,13 @@ function foo2($arg) {
}
function foo3() {
- error_reporting(E_ALL);
- echo $undef3;
- throw new Exception("test");
+ error_reporting(E_ALL);
+ echo $undef3;
+ throw new Exception("test");
}
try {
- @foo1(@foo2(@foo3()));
+ @foo1(@foo2(@foo3()));
} catch (Exception $e) {
}
@@ -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..39e52adbf5 100644
--- a/Zend/tests/error_reporting09.phpt
+++ b/Zend/tests/error_reporting09.phpt
@@ -6,15 +6,15 @@ testing @ and error_reporting - 9
error_reporting(E_ALL & ~E_DEPRECATED);
function bar() {
- echo @$blah;
- echo $undef2;
+ echo @$blah;
+ echo $undef2;
}
function foo() {
- echo @$undef;
- error_reporting(E_ALL);
- echo $blah;
- return bar();
+ echo @$undef;
+ error_reporting(E_ALL);
+ echo $blah;
+ return bar();
}
@foo();
@@ -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..c3ad2668cd 100644
--- a/Zend/tests/error_reporting10.phpt
+++ b/Zend/tests/error_reporting10.phpt
@@ -7,14 +7,13 @@ error_reporting(E_ALL);
function make_exception()
{
- @$blah;
- str_replace();
- error_reporting(0);
- throw new Exception();
+ @$blah;
+ error_reporting(0);
+ throw new Exception();
}
try {
- @make_exception();
+ @make_exception();
} catch (Exception $e) {}
var_dump(error_reporting());
@@ -22,7 +21,7 @@ var_dump(error_reporting());
error_reporting(E_ALL&~E_NOTICE);
try {
- @make_exception();
+ @make_exception();
} catch (Exception $e) {}
var_dump(error_reporting());
diff --git a/Zend/tests/eval_parse_error_with_doc_comment.phpt b/Zend/tests/eval_parse_error_with_doc_comment.phpt
index 62561aaa79..09bc39b83d 100644
--- a/Zend/tests/eval_parse_error_with_doc_comment.phpt
+++ b/Zend/tests/eval_parse_error_with_doc_comment.phpt
@@ -12,4 +12,4 @@ EOC
?>
--EXPECTF--
-Parse error: syntax error, unexpected end of file in %s(%d) : eval()'d code on line %d
+Parse error: Unclosed '{' in %s(%d) : eval()'d code on line %d
diff --git a/Zend/tests/exception_001.phpt b/Zend/tests/exception_001.phpt
index a206f3461c..232ef012ed 100644
--- a/Zend/tests/exception_001.phpt
+++ b/Zend/tests/exception_001.phpt
@@ -4,25 +4,25 @@ Testing nested exceptions
<?php
try {
- try {
- try {
- try {
- throw new Exception(NULL);
- } catch (Exception $e) {
- var_dump($e->getMessage());
- throw $e;
- }
- } catch (Exception $e) {
- var_dump($e->getMessage());
- throw $e;
- }
- } catch (Exception $e) {
- var_dump($e->getMessage());
- throw $e;
- }
+ try {
+ try {
+ try {
+ throw new Exception(NULL);
+ } catch (Exception $e) {
+ var_dump($e->getMessage());
+ throw $e;
+ }
+ } catch (Exception $e) {
+ var_dump($e->getMessage());
+ throw $e;
+ }
+ } catch (Exception $e) {
+ var_dump($e->getMessage());
+ throw $e;
+ }
} catch (Exception $e) {
- var_dump($e->getMessage());
- throw $e;
+ var_dump($e->getMessage());
+ throw $e;
}
?>
diff --git a/Zend/tests/exception_002.phpt b/Zend/tests/exception_002.phpt
index 4554200aab..fee76de0ee 100644
--- a/Zend/tests/exception_002.phpt
+++ b/Zend/tests/exception_002.phpt
@@ -6,10 +6,10 @@ Testing exception and GOTO
goto foo;
try {
- print 1;
+ print 1;
- foo:
- print 2;
+ foo:
+ print 2;
} catch (Exception $e) {
}
diff --git a/Zend/tests/exception_004.phpt b/Zend/tests/exception_004.phpt
index d9ffc748a4..e94f0e1b6e 100644
--- a/Zend/tests/exception_004.phpt
+++ b/Zend/tests/exception_004.phpt
@@ -6,9 +6,9 @@ Throwing exception using a class that isn't derived from the Exception base clas
class Foo { }
try {
- throw new Foo();
+ throw new Foo();
} catch (Foo $e) {
- var_dump($e);
+ var_dump($e);
}
?>
diff --git a/Zend/tests/exception_007.phpt b/Zend/tests/exception_007.phpt
index b3da7099a2..c24dac1d8d 100644
--- a/Zend/tests/exception_007.phpt
+++ b/Zend/tests/exception_007.phpt
@@ -4,15 +4,15 @@ Setting previous exception
<?php
try {
- try {
- throw new Exception("First", 1, new Exception("Another", 0, NULL));
- }
- catch (Exception $e) {
- throw new Exception("Second", 2, $e);
- }
+ try {
+ throw new Exception("First", 1, new Exception("Another", 0, NULL));
+ }
+ catch (Exception $e) {
+ throw new Exception("Second", 2, $e);
+ }
}
catch (Exception $e) {
- throw new Exception("Third", 3, $e);
+ throw new Exception("Third", 3, $e);
}
?>
diff --git a/Zend/tests/exception_008.phpt b/Zend/tests/exception_008.phpt
index b88198302b..4640ec965a 100644
--- a/Zend/tests/exception_008.phpt
+++ b/Zend/tests/exception_008.phpt
@@ -5,16 +5,16 @@ Exception in __destruct while exception is pending
class TestFirst
{
- function __destruct() {
- throw new Exception("First");
- }
+ function __destruct() {
+ throw new Exception("First");
+ }
}
class TestSecond
{
- function __destruct() {
- throw new Exception("Second");
- }
+ function __destruct() {
+ throw new Exception("Second");
+ }
}
$ar = array(new TestFirst, new TestSecond);
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_013.phpt b/Zend/tests/exception_013.phpt
index d8f5d907e3..93d8576176 100644
--- a/Zend/tests/exception_013.phpt
+++ b/Zend/tests/exception_013.phpt
@@ -3,37 +3,37 @@ Exceptions on improper access to static class properties
--FILE--
<?php
class C {
- static private $p = 0;
+ static private $p = 0;
}
try {
- var_dump(C::$a);
+ var_dump(C::$a);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
+ echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
}
try {
- var_dump(C::$p);
+ var_dump(C::$p);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
+ echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
}
try {
- unset(C::$a);
+ unset(C::$a);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
+ echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
}
var_dump(C::$a);
?>
--EXPECTF--
-Exception: Access to undeclared static property: C::$a in %sexception_013.php on line 7
+Exception: Access to undeclared static property C::$a in %s on line %d
Exception: Cannot access private property C::$p in %sexception_013.php on line 13
Exception: Attempt to unset static property C::$a in %sexception_013.php on line 19
-Fatal error: Uncaught Error: Access to undeclared static property: C::$a in %sexception_013.php:24
+Fatal error: Uncaught Error: Access to undeclared static property C::$a in %s:%d
Stack trace:
#0 {main}
thrown in %sexception_013.php on line 24
diff --git a/Zend/tests/exception_014.phpt b/Zend/tests/exception_014.phpt
index fedeee21c9..aaf411dae5 100644
--- a/Zend/tests/exception_014.phpt
+++ b/Zend/tests/exception_014.phpt
@@ -3,14 +3,14 @@ Exceptions on improper access to static class properties
--FILE--
<?php
class C {
- private $p = 0;
+ private $p = 0;
}
$x = new C;
try {
- var_dump($x->p);
+ var_dump($x->p);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
+ echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
}
var_dump($x->p);
diff --git a/Zend/tests/exception_015.phpt b/Zend/tests/exception_015.phpt
index e35a1eefe2..a2b27154f6 100644
--- a/Zend/tests/exception_015.phpt
+++ b/Zend/tests/exception_015.phpt
@@ -4,9 +4,9 @@ Exceptions on improper access to string
<?php
$s = "ABC";
try {
- $s[] = "D";
+ $s[] = "D";
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
+ echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
}
$s[] = "D";
diff --git a/Zend/tests/exception_016.phpt b/Zend/tests/exception_016.phpt
index 98831d933a..5b52cf72cd 100644
--- a/Zend/tests/exception_016.phpt
+++ b/Zend/tests/exception_016.phpt
@@ -3,9 +3,9 @@ Exceptions on improper usage of $this
--FILE--
<?php
try {
- $this->foo();
+ $this->foo();
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
+ echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
}
$this->foo();
diff --git a/Zend/tests/exception_017.phpt b/Zend/tests/exception_017.phpt
index 8d87ec6ee9..f2f5f964ce 100644
--- a/Zend/tests/exception_017.phpt
+++ b/Zend/tests/exception_017.phpt
@@ -3,36 +3,38 @@ Exceptions on improper usage of $this
--FILE--
<?php
abstract class C {
- abstract static function foo();
+ abstract static function foo();
}
function foo(callable $x) {
}
try {
- C::foo();
+ 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");
+ 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: foo(): Argument #1 ($x) must be of type callable, string given, called 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_018.phpt b/Zend/tests/exception_018.phpt
index aa39d53b67..b61a788288 100644
--- a/Zend/tests/exception_018.phpt
+++ b/Zend/tests/exception_018.phpt
@@ -8,7 +8,7 @@ throw new Hello(new stdClass);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Wrong parameters for Hello([string $message [, long $code [, Throwable $previous = NULL]]]) in %sexception_018.php:%d
+Fatal error: Uncaught TypeError: Exception::__construct(): Argument #1 ($message) must be of type string, stdClass given in %s:%d
Stack trace:
#0 %sexception_018.php(%d): Exception->__construct(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/exception_019.phpt b/Zend/tests/exception_019.phpt
index 4ebb077fe6..45b87956c9 100644
--- a/Zend/tests/exception_019.phpt
+++ b/Zend/tests/exception_019.phpt
@@ -7,7 +7,7 @@ throw new Exception(new stdClass);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Wrong parameters for Exception([string $message [, long $code [, Throwable $previous = NULL]]]) in %sexception_019.php:%d
+Fatal error: Uncaught TypeError: Exception::__construct(): Argument #1 ($message) must be of type string, stdClass given in %s:%d
Stack trace:
#0 %sexception_019.php(%d): Exception->__construct(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/exception_020.phpt b/Zend/tests/exception_020.phpt
index 6f8981f5e6..680a1a0d1a 100644
--- a/Zend/tests/exception_020.phpt
+++ b/Zend/tests/exception_020.phpt
@@ -8,7 +8,7 @@ throw new MyErrorException(new stdClass);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Wrong parameters for MyErrorException([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Throwable $previous = NULL]]]]]]) in %sexception_020.php:%d
+Fatal error: Uncaught TypeError: ErrorException::__construct(): Argument #1 ($message) must be of type string, stdClass given in %s:%d
Stack trace:
#0 %sexception_020.php(%d): ErrorException->__construct(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/exception_021.phpt b/Zend/tests/exception_021.phpt
index 5955e7989b..6fa7e49d80 100644
--- a/Zend/tests/exception_021.phpt
+++ b/Zend/tests/exception_021.phpt
@@ -8,7 +8,7 @@ throw new Hello(new stdClass);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Wrong parameters for Hello([string $message [, long $code [, Throwable $previous = NULL]]]) in %sexception_021.php:%d
+Fatal error: Uncaught TypeError: Error::__construct(): Argument #1 ($message) must be of type string, stdClass given in %s:%d
Stack trace:
#0 %sexception_021.php(%d): Error->__construct(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/exception_022.phpt b/Zend/tests/exception_022.phpt
index 83d47145c3..604d3314c2 100644
--- a/Zend/tests/exception_022.phpt
+++ b/Zend/tests/exception_022.phpt
@@ -7,7 +7,7 @@ throw new Error(new stdClass);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Wrong parameters for Error([string $message [, long $code [, Throwable $previous = NULL]]]) in %sexception_022.php:%d
+Fatal error: Uncaught TypeError: Error::__construct(): Argument #1 ($message) must be of type string, stdClass given in %s:%d
Stack trace:
#0 %sexception_022.php(%d): Error->__construct(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/exception_023.phpt b/Zend/tests/exception_023.phpt
index 34de77a476..76892c82f2 100644
--- a/Zend/tests/exception_023.phpt
+++ b/Zend/tests/exception_023.phpt
@@ -4,7 +4,7 @@ Ensure proper backtraces with anon classes
<?php
(function($obj) {
- throw new Exception();
+ throw new Exception();
})(new class {});
?>
diff --git a/Zend/tests/exception_024.phpt b/Zend/tests/exception_024.phpt
new file mode 100644
index 0000000000..67a2b87532
--- /dev/null
+++ b/Zend/tests/exception_024.phpt
@@ -0,0 +1,19 @@
+--TEST--
+zend.exception_string_param_max_len ini setting
+--INI--
+zend.exception_string_param_max_len = 23
+--FILE--
+<?php
+
+function main($arg) {
+ throw new Exception();
+}
+main('123456789012345678901234567890');
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Exception in %s:%d
+Stack trace:
+#0 %s(%d): main('12345678901234567890123...')
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/exception_025.phpt b/Zend/tests/exception_025.phpt
new file mode 100644
index 0000000000..b81c5406d6
--- /dev/null
+++ b/Zend/tests/exception_025.phpt
@@ -0,0 +1,41 @@
+--TEST--
+zend.exception_string_param_max_len ini setting
+--FILE--
+<?php
+
+function main($arg) {
+ echo (new Exception()), "\n";
+}
+var_dump(ini_set('zend.exception_string_param_max_len', '-1'));
+var_dump(ini_set('zend.exception_string_param_max_len', '1000001'));
+var_dump(ini_set('zend.exception_string_param_max_len', '1000000'));
+var_dump(ini_set('zend.exception_string_param_max_len', '20'));
+main('short');
+main('123456789012345678901234567890');
+var_dump(ini_set('zend.exception_string_param_max_len', '0'));
+main('short');
+main('');
+
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+string(2) "15"
+string(7) "1000000"
+Exception in %s:%d
+Stack trace:
+#0 %s(10): main('short')
+#1 {main}
+Exception in %s:%d
+Stack trace:
+#0 %s(11): main('12345678901234567890...')
+#1 {main}
+string(2) "20"
+Exception in %s:%d
+Stack trace:
+#0 %s(13): main('...')
+#1 {main}
+Exception in %s:%d
+Stack trace:
+#0 %s(14): main('')
+#1 {main}
diff --git a/Zend/tests/exception_before_fatal.phpt b/Zend/tests/exception_before_fatal.phpt
index 7a1399fb7a..edc63b2394 100644
--- a/Zend/tests/exception_before_fatal.phpt
+++ b/Zend/tests/exception_before_fatal.phpt
@@ -55,10 +55,10 @@ try {
}
?>
--EXPECT--
-string(23) "Undefined variable: foo"
-string(23) "Undefined variable: foo"
-string(23) "Undefined variable: foo"
-string(23) "Undefined variable: foo"
-string(23) "Undefined variable: foo"
-string(23) "Undefined variable: foo"
-string(23) "Undefined variable: foo"
+string(23) "Undefined variable $foo"
+string(23) "Undefined variable $foo"
+string(23) "Undefined variable $foo"
+string(23) "Undefined variable $foo"
+string(23) "Undefined variable $foo"
+string(23) "Undefined variable $foo"
+string(23) "Undefined variable $foo"
diff --git a/Zend/tests/exception_delayed_message.phpt b/Zend/tests/exception_delayed_message.phpt
new file mode 100644
index 0000000000..e9f7a1fa21
--- /dev/null
+++ b/Zend/tests/exception_delayed_message.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Exception with delayed message computation
+--FILE--
+<?php
+
+class MyException extends Exception {
+ public $message;
+ public $messageCallback;
+
+ public function __construct() {
+ $this->messageCallback = static function() {
+ return "Foobar";
+ };
+ $this->message = new class($this->message, $this->messageCallback) {
+ private $message;
+ private $messageCallback;
+
+ public function __construct(&$message, &$messageCallback)
+ {
+ $this->message = &$message;
+ $this->messageCallback = &$messageCallback;
+ }
+
+ public function __toString(): string
+ {
+ $messageCallback = $this->messageCallback;
+ $this->messageCallback = null;
+ return $this->message = $messageCallback();
+ }
+ };
+ }
+}
+
+throw new MyException;
+
+?>
+--EXPECTF--
+Fatal error: Uncaught MyException: Foobar in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/exception_from_toString.phpt b/Zend/tests/exception_from_toString.phpt
index ee6dde9187..dd4de341ca 100644
--- a/Zend/tests/exception_from_toString.phpt
+++ b/Zend/tests/exception_from_toString.phpt
@@ -19,7 +19,7 @@ try { $x = $badStr . $str; }
catch (Exception $e) { echo $e->getMessage(), "\n"; }
try { $x = $str .= $badStr; }
catch (Exception $e) { echo $e->getMessage(), "\n"; }
-var_dump($str);
+var_dump($str);
try { $x = $num . $badStr; }
catch (Exception $e) { echo $e->getMessage(), "\n"; }
try { $x = $badStr . $num; }
diff --git a/Zend/tests/exception_handler_001.phpt b/Zend/tests/exception_handler_001.phpt
index d4e205cceb..bb3cf4eb7a 100644
--- a/Zend/tests/exception_handler_001.phpt
+++ b/Zend/tests/exception_handler_001.phpt
@@ -6,7 +6,7 @@ exception handler tests - 1
set_exception_handler("foo");
function foo($e) {
- var_dump(get_class($e)." thrown!");
+ var_dump(get_class($e)." thrown!");
}
class test extends Exception {
diff --git a/Zend/tests/exception_handler_002.phpt b/Zend/tests/exception_handler_002.phpt
index da57572300..4570cc85ab 100644
--- a/Zend/tests/exception_handler_002.phpt
+++ b/Zend/tests/exception_handler_002.phpt
@@ -6,8 +6,8 @@ exception handler tests - 2
set_exception_handler("foo");
function foo($e) {
- var_dump(get_class($e)." thrown!");
- throw new Exception();
+ var_dump(get_class($e)." thrown!");
+ throw new Exception();
}
class test extends Exception {
diff --git a/Zend/tests/exception_handler_003.phpt b/Zend/tests/exception_handler_003.phpt
index 8d3635c4b8..a398a16df7 100644
--- a/Zend/tests/exception_handler_003.phpt
+++ b/Zend/tests/exception_handler_003.phpt
@@ -5,13 +5,13 @@ exception handler tests - 3
class test {
- function foo () {
- set_exception_handler(array($this, "bar"));
- }
+ function foo () {
+ set_exception_handler(array($this, "bar"));
+ }
- function bar($e) {
- var_dump(get_class($e)." thrown!");
- }
+ function bar($e) {
+ var_dump(get_class($e)." thrown!");
+ }
}
$a = new test;
diff --git a/Zend/tests/exception_handler_004.phpt b/Zend/tests/exception_handler_004.phpt
index 69a4136b08..a9f9e77a59 100644
--- a/Zend/tests/exception_handler_004.phpt
+++ b/Zend/tests/exception_handler_004.phpt
@@ -3,19 +3,18 @@ exception handler tests - 4
--FILE--
<?php
-set_exception_handler("fo");
-set_exception_handler(array("", ""));
-set_exception_handler();
-set_exception_handler("foo", "bar");
+try {
+ set_exception_handler("fo");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ set_exception_handler(array("", ""));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
-echo "Done\n";
?>
---EXPECTF--
-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
+--EXPECT--
+set_exception_handler(): Argument #1 ($callback) must be a valid callback or null, function "fo" not found or invalid function name
+set_exception_handler(): Argument #1 ($callback) must be a valid callback or null, class "" not found
diff --git a/Zend/tests/exception_handler_005.phpt b/Zend/tests/exception_handler_005.phpt
index af96627561..cad39dc401 100644
--- a/Zend/tests/exception_handler_005.phpt
+++ b/Zend/tests/exception_handler_005.phpt
@@ -7,11 +7,11 @@ set_exception_handler("foo");
set_exception_handler("foo1");
function foo($e) {
- var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
+ var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
}
function foo1($e) {
- var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
+ var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
}
diff --git a/Zend/tests/exception_handler_006.phpt b/Zend/tests/exception_handler_006.phpt
index 861a10ffa1..7bed20bbf7 100644
--- a/Zend/tests/exception_handler_006.phpt
+++ b/Zend/tests/exception_handler_006.phpt
@@ -9,11 +9,11 @@ set_exception_handler("foo1");
restore_exception_handler();
function foo($e) {
- var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
+ var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
}
function foo1($e) {
- var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
+ var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
}
diff --git a/Zend/tests/exception_handler_007.phpt b/Zend/tests/exception_handler_007.phpt
new file mode 100644
index 0000000000..757154dde5
--- /dev/null
+++ b/Zend/tests/exception_handler_007.phpt
@@ -0,0 +1,26 @@
+--TEST--
+exception handler tests - 7
+--FILE--
+<?php
+
+set_exception_handler("foo");
+set_exception_handler(null);
+
+function foo($e) {
+ var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
+}
+
+function foo1($e) {
+ var_dump(__FUNCTION__."(): ".get_class($e)." thrown!");
+}
+
+
+throw new excEption();
+
+echo "Done\n";
+?>
+--EXPECTF--
+Fatal error: Uncaught Exception in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/exit_exception_handler.phpt b/Zend/tests/exit_exception_handler.phpt
new file mode 100644
index 0000000000..eabd0fb906
--- /dev/null
+++ b/Zend/tests/exit_exception_handler.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Exception handler should not be invoked for exit()
+--FILE--
+<?php
+
+set_exception_handler(function($e) {
+ var_dump($e);
+});
+
+exit("Exit\n");
+
+?>
+--EXPECT--
+Exit
diff --git a/Zend/tests/exit_finally_1.phpt b/Zend/tests/exit_finally_1.phpt
new file mode 100644
index 0000000000..8e7ba74842
--- /dev/null
+++ b/Zend/tests/exit_finally_1.phpt
@@ -0,0 +1,19 @@
+--TEST--
+exit() and finally (1)
+--FILE--
+<?php
+
+// TODO: In the future, we should execute the finally block.
+
+try {
+ exit("Exit\n");
+} catch (Throwable $e) {
+ echo "Not caught\n";
+} finally {
+ echo "Finally\n";
+}
+echo "Not executed\n";
+
+?>
+--EXPECT--
+Exit
diff --git a/Zend/tests/exit_finally_2.phpt b/Zend/tests/exit_finally_2.phpt
new file mode 100644
index 0000000000..0a3f5dc7a1
--- /dev/null
+++ b/Zend/tests/exit_finally_2.phpt
@@ -0,0 +1,23 @@
+--TEST--
+exit() and finally (2)
+--FILE--
+<?php
+
+// TODO: In the future, we should execute the finally block.
+
+try {
+ try {
+ exit("Exit\n");
+ } catch (Throwable $e) {
+ echo "Not caught\n";
+ } finally {
+ throw new Exception("Finally exception");
+ }
+ echo "Not executed\n";
+} catch (Exception $e) {
+ echo "Caught {$e->getMessage()}\n";
+}
+
+?>
+--EXPECT--
+Exit
diff --git a/Zend/tests/exit_finally_3.phpt b/Zend/tests/exit_finally_3.phpt
new file mode 100644
index 0000000000..12d7747ade
--- /dev/null
+++ b/Zend/tests/exit_finally_3.phpt
@@ -0,0 +1,19 @@
+--TEST--
+exit() and finally (3)
+--FILE--
+<?php
+
+// TODO: In the future, we should execute the finally block.
+
+function test() {
+ try {
+ exit("Exit\n");
+ } finally {
+ return 42;
+ }
+}
+var_dump(test());
+
+?>
+--EXPECT--
+Exit
diff --git a/Zend/tests/flexible-heredoc-error7.phpt b/Zend/tests/flexible-heredoc-error7.phpt
index ae9d1da0cd..d31b430b56 100644
--- a/Zend/tests/flexible-heredoc-error7.phpt
+++ b/Zend/tests/flexible-heredoc-error7.phpt
@@ -8,4 +8,4 @@ Note: the closing ?> has been deliberately elided.
echo <<<END
--EXPECTF--
-Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in %s on line %d
+Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" in %s on line %d
diff --git a/Zend/tests/flexible-nowdoc-error7.phpt b/Zend/tests/flexible-nowdoc-error7.phpt
index 27d5dbb46e..b31b3e5d3b 100644
--- a/Zend/tests/flexible-nowdoc-error7.phpt
+++ b/Zend/tests/flexible-nowdoc-error7.phpt
@@ -8,4 +8,4 @@ Note: the closing ?> has been deliberately elided.
echo <<<'END'
--EXPECTF--
-Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in %s on line %d
+Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" in %s on line %d
diff --git a/Zend/tests/flexible-nowdoc-error8.phpt b/Zend/tests/flexible-nowdoc-error8.phpt
index ba6a2b85d8..5c5643206b 100644
--- a/Zend/tests/flexible-nowdoc-error8.phpt
+++ b/Zend/tests/flexible-nowdoc-error8.phpt
@@ -8,4 +8,4 @@ eval('<<<\'end\'
?>
--EXPECTF--
-Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in %s on line %d
+Parse error: syntax error, unexpected end of file, expecting variable or heredoc end or "${" or "{$" in %s on line %d
diff --git a/Zend/tests/foreach.phpt b/Zend/tests/foreach.phpt
index 0835e40aaf..059a3a4c32 100644
--- a/Zend/tests/foreach.phpt
+++ b/Zend/tests/foreach.phpt
@@ -4,11 +4,11 @@ foreach() by-ref bug
<?php
$foo = array(1,2,3,4);
foreach($foo as $key => &$val) {
- if($val == 3) {
- $foo[$key] = 0;
- } else {
- $val++;
- }
+ if($val == 3) {
+ $foo[$key] = 0;
+ } else {
+ $val++;
+ }
}
var_dump($foo);
?>
diff --git a/Zend/tests/foreach_002.phpt b/Zend/tests/foreach_002.phpt
index 77fe20cb64..23e21d640b 100644
--- a/Zend/tests/foreach_002.phpt
+++ b/Zend/tests/foreach_002.phpt
@@ -8,15 +8,12 @@ zend.enable_gc=1
error_reporting(E_ALL);
foreach (($a = array('a' => array('a' => &$a))) as $a) {
- var_dump($a);
+ var_dump($a);
}
?>
--EXPECT--
array(1) {
["a"]=>
- &array(1) {
- ["a"]=>
- *RECURSION*
- }
+ *RECURSION*
}
diff --git a/Zend/tests/foreach_003.phpt b/Zend/tests/foreach_003.phpt
index 71b0f2a5a3..95863e71ba 100644
--- a/Zend/tests/foreach_003.phpt
+++ b/Zend/tests/foreach_003.phpt
@@ -8,14 +8,14 @@ class IT implements Iterator {
private $trap = null;
function __construct($count, $trap = null) {
- $this->count = $count;
- $this->trap = $trap;
+ $this->count = $count;
+ $this->trap = $trap;
}
function trap($trap) {
- if ($trap === $this->trap) {
- throw new Exception($trap);
- }
+ if ($trap === $this->trap) {
+ throw new Exception($trap);
+ }
}
function rewind() {$this->trap(__FUNCTION__); $this->n = 0;}
@@ -26,28 +26,28 @@ class IT implements Iterator {
}
foreach(['rewind', 'valid', 'key', 'current', 'next'] as $trap) {
- $obj = new IT(3, $trap);
- try {
- // IS_CV
- foreach ($obj as $key => $val) echo "$val\n";
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- unset($obj);
+ $obj = new IT(3, $trap);
+ try {
+ // IS_CV
+ foreach ($obj as $key => $val) echo "$val\n";
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ unset($obj);
- try {
- // IS_VAR
- foreach (new IT(3, $trap) as $key => $val) echo "$val\n";
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
+ try {
+ // IS_VAR
+ foreach (new IT(3, $trap) as $key => $val) echo "$val\n";
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
- try {
- // IS_TMP_VAR
- foreach ((object)new IT(2, $trap) as $key => $val) echo "$val\n";
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
+ try {
+ // IS_TMP_VAR
+ foreach ((object)new IT(2, $trap) as $key => $val) echo "$val\n";
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_004.phpt b/Zend/tests/foreach_004.phpt
index 1f754a77ed..8a7b915c2e 100644
--- a/Zend/tests/foreach_004.phpt
+++ b/Zend/tests/foreach_004.phpt
@@ -6,14 +6,14 @@ class IT extends ArrayIterator {
private $n = 0;
function __construct($trap = null) {
- parent::__construct([0, 1]);
- $this->trap = $trap;
+ parent::__construct([0, 1]);
+ $this->trap = $trap;
}
function trap($trap) {
- if ($trap === $this->trap) {
- throw new Exception($trap);
- }
+ if ($trap === $this->trap) {
+ throw new Exception($trap);
+ }
}
function rewind() {$this->trap(__FUNCTION__); return parent::rewind();}
@@ -23,28 +23,28 @@ class IT extends ArrayIterator {
}
foreach(['rewind', 'valid', 'key', 'next'] as $trap) {
- $obj = new IT($trap);
- try {
- // IS_CV
- foreach ($obj as $key => &$val) echo "$val\n";
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- unset($obj);
+ $obj = new IT($trap);
+ try {
+ // IS_CV
+ foreach ($obj as $key => &$val) echo "$val\n";
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ unset($obj);
- try {
- // IS_VAR
- foreach (new IT($trap) as $key => &$val) echo "$val\n";
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
+ try {
+ // IS_VAR
+ foreach (new IT($trap) as $key => &$val) echo "$val\n";
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
- try {
- // IS_TMP_VAR
- foreach ((object)new IT($trap) as $key => &$val) echo "$val\n";
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
+ try {
+ // IS_TMP_VAR
+ foreach ((object)new IT($trap) as $key => &$val) echo "$val\n";
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_005.phpt b/Zend/tests/foreach_005.phpt
index 063dc70de0..097d74d4fd 100644
--- a/Zend/tests/foreach_005.phpt
+++ b/Zend/tests/foreach_005.phpt
@@ -4,10 +4,10 @@ Nested foreach by reference on the same array
<?php
$a = [1,2,3];
foreach($a as &$x) {
- foreach($a as &$y) {
- echo "$x-$y\n";
- $y++;
- }
+ foreach($a as &$y) {
+ echo "$x-$y\n";
+ $y++;
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_006.phpt b/Zend/tests/foreach_006.phpt
index 65d6fdc52c..8e81a686b5 100644
--- a/Zend/tests/foreach_006.phpt
+++ b/Zend/tests/foreach_006.phpt
@@ -3,9 +3,9 @@ Foreach by reference on constant
--FILE--
<?php
for ($i = 0; $i < 3; $i++) {
- foreach ([1,2,3] as &$val) {
- echo "$val\n";
- }
+ foreach ([1,2,3] as &$val) {
+ echo "$val\n";
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_007.phpt b/Zend/tests/foreach_007.phpt
index b99bc73ebe..09cf60246e 100644
--- a/Zend/tests/foreach_007.phpt
+++ b/Zend/tests/foreach_007.phpt
@@ -4,8 +4,8 @@ Foreach by reference and inserting new element when we are already at the end
<?php
$a = [1];
foreach($a as &$v) {
- echo "$v\n";
- $a[1]=2;
+ echo "$v\n";
+ $a[1]=2;
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_008.phpt b/Zend/tests/foreach_008.phpt
index c68bcd89da..c412ac3f8d 100644
--- a/Zend/tests/foreach_008.phpt
+++ b/Zend/tests/foreach_008.phpt
@@ -4,13 +4,13 @@ Nested foreach by reference and array modification
<?php
$a = [0, 1, 2, 3];
foreach ($a as &$x) {
- foreach ($a as &$y) {
- echo "$x - $y\n";
- if ($x == 0 && $y == 1) {
- unset($a[2]);
- unset($a[1]);
- }
- }
+ foreach ($a as &$y) {
+ echo "$x - $y\n";
+ if ($x == 0 && $y == 1) {
+ unset($a[2]);
+ unset($a[1]);
+ }
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_009.phpt b/Zend/tests/foreach_009.phpt
index 754d9acb2f..a1859fc7ef 100644
--- a/Zend/tests/foreach_009.phpt
+++ b/Zend/tests/foreach_009.phpt
@@ -5,12 +5,12 @@ Nested foreach by reference and array modification with resize
$a = [0, 1, 2, 3, 4, 5, 6, 7];
unset($a[0], $a[1], $a[2], $a[3]);
foreach ($a as &$ref) {
- foreach ($a as &$ref2) {
- echo "$ref-$ref2\n";
- if ($ref == 5 && $ref2 == 6) {
- $a[42] = 8;
- }
- }
+ foreach ($a as &$ref2) {
+ echo "$ref-$ref2\n";
+ if ($ref == 5 && $ref2 == 6) {
+ $a[42] = 8;
+ }
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_010.phpt b/Zend/tests/foreach_010.phpt
index a86f87f6df..8a60b89dc2 100644
--- a/Zend/tests/foreach_010.phpt
+++ b/Zend/tests/foreach_010.phpt
@@ -5,12 +5,12 @@ Nested foreach by value over object and object modification with resize
$o = (object)['a'=>0, 'b'=>1, 'c'=>2, 'd'=>3, 'e'=>4, 'f'=>5, 'g'=>6, 'h'=>7];
unset($o->a, $o->b, $o->c, $o->d);
foreach ($o as $v1) {
- foreach ($o as $v2) {
- echo "$v1-$v2\n";
- if ($v1 == 5 && $v2 == 6) {
- $o->i = 8;
- }
- }
+ foreach ($o as $v2) {
+ echo "$v1-$v2\n";
+ if ($v1 == 5 && $v2 == 6) {
+ $o->i = 8;
+ }
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_011.phpt b/Zend/tests/foreach_011.phpt
index e91426fb27..37eb55a126 100644
--- a/Zend/tests/foreach_011.phpt
+++ b/Zend/tests/foreach_011.phpt
@@ -4,10 +4,10 @@ sort() functions precerve foreach by reference iterator pointer
<?php
$a = [1,2,3,4,5,0];
foreach($a as &$v) {
- echo "$v\n";
- if ($v == 3) {
- rsort($a);
- }
+ echo "$v\n";
+ if ($v == 3) {
+ rsort($a);
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_012.phpt b/Zend/tests/foreach_012.phpt
index 517e0ac943..59a5aff0a8 100644
--- a/Zend/tests/foreach_012.phpt
+++ b/Zend/tests/foreach_012.phpt
@@ -4,10 +4,10 @@ array_walk() function precerve foreach by reference iterator pointer
<?php
$a = [1,2,3,4,5];
foreach($a as &$v) {
- echo "$v\n";
- if ($v == 3) {
- array_walk($a, function (&$x) {$x+=10;});
- }
+ echo "$v\n";
+ if ($v == 3) {
+ array_walk($a, function (&$x) {$x+=10;});
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_013.phpt b/Zend/tests/foreach_013.phpt
index cfbb3d7f79..8a88c459ec 100644
--- a/Zend/tests/foreach_013.phpt
+++ b/Zend/tests/foreach_013.phpt
@@ -4,10 +4,10 @@ array_push() function precerve foreach by reference iterator pointer
<?php
$a = [1,2,3];
foreach($a as &$v) {
- echo "$v\n";
- if ($v == 3) {
- array_push($a, 4);
- }
+ echo "$v\n";
+ if ($v == 3) {
+ array_push($a, 4);
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_014.phpt b/Zend/tests/foreach_014.phpt
index 8d0ac582a9..ce05ad1410 100644
--- a/Zend/tests/foreach_014.phpt
+++ b/Zend/tests/foreach_014.phpt
@@ -4,10 +4,10 @@ array_pop() function precerve foreach by reference iterator pointer
<?php
$a = [1,2,3];
foreach($a as &$v) {
- echo "$v\n";
- if ($v == 2) {
- array_pop($a);
- }
+ echo "$v\n";
+ if ($v == 2) {
+ array_pop($a);
+ }
}
?>
--EXPECT--
diff --git a/Zend/tests/foreach_015.phpt b/Zend/tests/foreach_015.phpt
index b7482b66a0..865356db1b 100644
--- a/Zend/tests/foreach_015.phpt
+++ b/Zend/tests/foreach_015.phpt
@@ -4,8 +4,8 @@ array_shift() function precerve foreach by reference iterator pointer
<?php
$a = [1,2,3,4];
foreach($a as &$v) {
- echo "$v\n";
- array_shift($a);
+ echo "$v\n";
+ array_shift($a);
}
var_dump($a);
?>
diff --git a/Zend/tests/foreach_016.phpt b/Zend/tests/foreach_016.phpt
index 423c8dd0a6..461c5b2431 100644
--- a/Zend/tests/foreach_016.phpt
+++ b/Zend/tests/foreach_016.phpt
@@ -4,10 +4,10 @@ array_unshift() function precerve foreach by reference iterator pointer
<?php
$a = [1,2,3];
foreach($a as &$v) {
- echo "$v\n";
- if ($v == 2) {
- array_unshift($a, 0, 0, 0, 0, 0, 0, 0, 0);
- }
+ echo "$v\n";
+ if ($v == 2) {
+ array_unshift($a, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
}
var_dump(count($a));
?>
diff --git a/Zend/tests/foreach_017.phpt b/Zend/tests/foreach_017.phpt
index e27b04c934..0220862363 100644
--- a/Zend/tests/foreach_017.phpt
+++ b/Zend/tests/foreach_017.phpt
@@ -6,11 +6,11 @@ array_splice() function precerve foreach by reference iterator pointer
$done = 0;
$a = [0,1,2,3,4];
foreach($a as &$v) {
- echo "$v\n";
- if (!$done && $v == 3) {
- $done = 1;
- array_splice($a, 1, 2);
- }
+ echo "$v\n";
+ if (!$done && $v == 3) {
+ $done = 1;
+ array_splice($a, 1, 2);
+ }
}
echo "\n";
@@ -18,11 +18,11 @@ echo "\n";
$done = 0;
$a = [0,1,2,3,4];
foreach($a as &$v) {
- echo "$v\n";
- if (!$done && $v == 0) {
- $done = 1;
- array_splice($a, 2, 2);
- }
+ echo "$v\n";
+ if (!$done && $v == 0) {
+ $done = 1;
+ array_splice($a, 2, 2);
+ }
}
echo "\n";
@@ -30,11 +30,11 @@ echo "\n";
$done = 0;
$a = [0,1,2,3,4];
foreach($a as &$v) {
- echo "$v\n";
- if (!$done && $v == 2) {
- $done = 1;
- array_splice($a, 1, 3);
- }
+ echo "$v\n";
+ if (!$done && $v == 2) {
+ $done = 1;
+ array_splice($a, 1, 3);
+ }
}
echo "\n";
@@ -44,11 +44,11 @@ $replacement = ['x', 'y', 'z'];
$done = 0;
$a = [0,1,2,3,4];
foreach($a as &$v) {
- echo "$v\n";
- if (!$done && $v == 3) {
- $done = 1;
- array_splice($a, 1, 2, $replacement);
- }
+ echo "$v\n";
+ if (!$done && $v == 3) {
+ $done = 1;
+ array_splice($a, 1, 2, $replacement);
+ }
}
echo "\n";
@@ -56,11 +56,11 @@ echo "\n";
$done = 0;
$a = [0,1,2,3,4];
foreach($a as &$v) {
- echo "$v\n";
- if (!$done && $v == 0) {
- $done = 1;
- array_splice($a, 2, 2, $replacement);
- }
+ echo "$v\n";
+ if (!$done && $v == 0) {
+ $done = 1;
+ array_splice($a, 2, 2, $replacement);
+ }
}
echo "\n";
@@ -68,11 +68,11 @@ echo "\n";
$done = 0;
$a = [0,1,2,3,4];
foreach($a as &$v) {
- echo "$v\n";
- if (!$done && $v == 2) {
- $done = 1;
- array_splice($a, 1, 3, $replacement);
- }
+ echo "$v\n";
+ if (!$done && $v == 2) {
+ $done = 1;
+ array_splice($a, 1, 3, $replacement);
+ }
}
echo "\n";
?>
diff --git a/Zend/tests/foreach_over_null.phpt b/Zend/tests/foreach_over_null.phpt
new file mode 100644
index 0000000000..d7abc3d096
--- /dev/null
+++ b/Zend/tests/foreach_over_null.phpt
@@ -0,0 +1,15 @@
+--TEST--
+foreach over null
+--FILE--
+<?php
+
+function test() {
+ foreach (null as $v) {
+ echo "Foo\n";
+ }
+}
+test();
+
+?>
+--EXPECTF--
+Warning: foreach() argument must be of type array|object, null given in %s on line %d
diff --git a/Zend/tests/foreach_shadowed_dyn_property.phpt b/Zend/tests/foreach_shadowed_dyn_property.phpt
index 8f71cdf240..acbd05bf6d 100644
--- a/Zend/tests/foreach_shadowed_dyn_property.phpt
+++ b/Zend/tests/foreach_shadowed_dyn_property.phpt
@@ -2,7 +2,7 @@
Dynamic property shadowed by private property
--FILE--
<?php
-
+
class Test {
private $prop = "Test";
diff --git a/Zend/tests/foreach_undefined.phpt b/Zend/tests/foreach_undefined.phpt
index aa4a160e6c..47a1e3053f 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
+Warning: foreach() argument must be of type array|object, null given in %s on line %d
Done
diff --git a/Zend/tests/foreach_unset_globals.phpt b/Zend/tests/foreach_unset_globals.phpt
index 8c505cdb04..96ab1bf6a3 100644
--- a/Zend/tests/foreach_unset_globals.phpt
+++ b/Zend/tests/foreach_unset_globals.phpt
@@ -5,7 +5,7 @@ traverse an array and use its keys to unset GLOBALS
$arr = array("a" => 1, "b" => 2);
foreach ($arr as $key => $val) {
- unset($GLOBALS[$key]);
+ unset($GLOBALS[$key]);
}
var_dump($arr);
diff --git a/Zend/tests/fr47160.phpt b/Zend/tests/fr47160.phpt
index 786183c0c1..9702537e37 100644
--- a/Zend/tests/fr47160.phpt
+++ b/Zend/tests/fr47160.phpt
@@ -4,52 +4,38 @@ Calling method from array
<?php
class Hello {
- public function world($x) {
- echo "Hello, $x\n";return $this;
- }
+ public function world($x) {
+ echo "Hello, $x\n";return $this;
+ }
}
class Hello2 {
- static public function world($x) {
- echo "Hello, $x\n";
- }
+ static public function world($x) {
+ echo "Hello, $x\n";
+ }
}
class Magic {
- public function __call($f, $a) {
- printf("%s called (%s)!\n", __METHOD__, $f);
- }
+ public function __call($f, $a) {
+ printf("%s called (%s)!\n", __METHOD__, $f);
+ }
}
class Magic2 {
- public static function __callStatic($f, $a) {
- printf("%s called (%s)!\n", __METHOD__, $f);
- }
+ public static function __callStatic($f, $a) {
+ printf("%s called (%s)!\n", __METHOD__, $f);
+ }
}
class Magic3 {
- public static function __callStatic($f, $a) {
- printf("%s called (%s)!\n", __METHOD__, $f);
- }
- public function __call($f, $a) {
- printf("%s called (%s)!\n", __METHOD__, $f);
- }
+ public static function __callStatic($f, $a) {
+ printf("%s called (%s)!\n", __METHOD__, $f);
+ }
+ public function __call($f, $a) {
+ printf("%s called (%s)!\n", __METHOD__, $f);
+ }
}
-$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'));
@@ -58,7 +44,7 @@ var_dump(call_user_func($f, 'again'));
printf("-----\n");
function bar() {
- return array(new Hello,'world');
+ return array(new Hello,'world');
}
$f = bar();
var_dump($f('there'));
@@ -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/func_get_args.phpt b/Zend/tests/func_get_args.phpt
index eea8ae4354..33cfdb02eb 100644
--- a/Zend/tests/func_get_args.phpt
+++ b/Zend/tests/func_get_args.phpt
@@ -1,10 +1,14 @@
--TEST--
-Testing func_get_args()
+Testing func_get_args() throws error when called from the global scope
--FILE--
<?php
-func_get_args();
+try {
+ func_get_args();
+} catch (\Error $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
---EXPECTF--
-Warning: func_get_args(): Called from the global scope - no function context in %s on line 3
+--EXPECT--
+func_get_args() cannot be called from the global scope
diff --git a/Zend/tests/func_sig_trailing_comma.phpt b/Zend/tests/func_sig_trailing_comma.phpt
new file mode 100644
index 0000000000..8153edbb05
--- /dev/null
+++ b/Zend/tests/func_sig_trailing_comma.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Trailing comma in function signatures
+--FILE--
+<?php
+
+function test(
+ $there,
+ $are,
+ $many,
+ $params,
+) {
+ echo "Foo\n";
+}
+
+class Test {
+ public function method(
+ $there,
+ $are,
+ $many,
+ $params,
+ ) {
+ echo "Foo\n";
+ }
+}
+
+$func = function(
+ $there,
+ $are,
+ $many,
+ $params,
+) {
+ echo "Foo\n";
+};
+
+$func = fn(
+ $there,
+ $shouldnt,
+ $be,
+ $many,
+ $params,
+) => print "Foo\n";
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/function_arguments/argument_count_correct.phpt b/Zend/tests/function_arguments/argument_count_correct.phpt
index 9c73b93520..e4e8e72b22 100644
--- a/Zend/tests/function_arguments/argument_count_correct.phpt
+++ b/Zend/tests/function_arguments/argument_count_correct.phpt
@@ -16,5 +16,6 @@ $fp = fopen(__FILE__, "r");
fclose($fp);
echo "done";
+?>
--EXPECT--
done
diff --git a/Zend/tests/function_arguments/argument_count_correct_strict.phpt b/Zend/tests/function_arguments/argument_count_correct_strict.phpt
index feed8b5964..be19471edb 100644
--- a/Zend/tests/function_arguments/argument_count_correct_strict.phpt
+++ b/Zend/tests/function_arguments/argument_count_correct_strict.phpt
@@ -16,5 +16,6 @@ $fp = fopen(__FILE__, "r");
fclose($fp);
echo "done";
+?>
--EXPECT--
done
diff --git a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt
index a8ba71c0bf..d23a6a0c70 100644
--- a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt
+++ b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt
@@ -2,9 +2,11 @@
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 arguments, 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..2b809cdb73 100644
--- a/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt
+++ b/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt
@@ -4,15 +4,21 @@ Call internal function with incorrect number of arguments with strict types
<?php
declare(strict_types=1);
try {
- substr("foo");
-} catch (\Error $e) {
- echo get_class($e) . PHP_EOL;
- echo $e->getMessage() . PHP_EOL;
+ substr("foo");
+} 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
+substr() expects at least 2 arguments, 1 given
+ArgumentCountError
+array_diff() expects at least 1 argument, 0 given
diff --git a/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt b/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt
index 94525c85b7..db9be6d851 100644
--- a/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt
+++ b/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt
@@ -3,36 +3,37 @@ Call userland function with incorrect number of arguments
--FILE--
<?php
try {
- function foo($bar) { }
- foo();
+ function foo($bar) { }
+ foo();
} catch (\Error $e) {
- echo get_class($e) . PHP_EOL;
- echo $e->getMessage() . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
try {
- function bar($foo, $bar) { }
- bar(1);
+ function bar($foo, $bar) { }
+ bar(1);
} catch (\Error $e) {
- echo get_class($e) . PHP_EOL;
- echo $e->getMessage() . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
function bat(int $foo, string $bar) { }
try {
- bat(123);
+ bat(123);
} catch (\Error $e) {
- echo get_class($e) . PHP_EOL;
- echo $e->getMessage() . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
try {
- bat("123");
+ bat("123");
} catch (\Error $e) {
- echo get_class($e) . PHP_EOL;
- echo $e->getMessage() . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
+?>
--EXPECTF--
ArgumentCountError
Too few arguments to function foo(), 0 passed in %s and exactly 1 expected
diff --git a/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt b/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt
index 1e535ea9f9..2a67a9ce4c 100644
--- a/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt
+++ b/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt
@@ -4,43 +4,44 @@ Call userland function with incorrect number of arguments with strict types
<?php
declare(strict_types=1);
try {
- function foo($bar) { }
- foo();
+ function foo($bar) { }
+ foo();
} catch (\Error $e) {
- echo get_class($e) . PHP_EOL;
- echo $e->getMessage() . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
try {
- function bar($foo, $bar) { }
- bar(1);
+ function bar($foo, $bar) { }
+ bar(1);
} catch (\Error $e) {
- echo get_class($e) . PHP_EOL;
- echo $e->getMessage() . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
function bat(int $foo, string $bar) { }
try {
- bat(123);
+ bat(123);
} catch (\Error $e) {
- echo get_class($e) . PHP_EOL;
- echo $e->getMessage() . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
try {
- bat("123");
+ bat("123");
} catch (\Error $e) {
- echo get_class($e) . PHP_EOL;
- echo $e->getMessage() . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
try {
- bat(123, 456);
+ bat(123, 456);
} catch (\Error $e) {
- echo get_class($e) . PHP_EOL;
- echo $e->getMessage() . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
+?>
--EXPECTF--
ArgumentCountError
Too few arguments to function foo(), 0 passed in %s and exactly 1 expected
@@ -49,6 +50,6 @@ Too few arguments to function bar(), 1 passed in %s and exactly 2 expected
ArgumentCountError
Too few arguments to function bat(), 1 passed in %s and exactly 2 expected
TypeError
-Argument 1 passed to bat() must be of the type int, string given, called in %s
+bat(): Argument #1 ($foo) must be of type int, string given, called in %s on line %d
TypeError
-Argument 2 passed to bat() must be of the type string, int given, called in %s
+bat(): Argument #2 ($bar) must be of type string, int given, called in %s on line %d
diff --git a/Zend/tests/function_arguments/call_with_leading_comma_error.phpt b/Zend/tests/function_arguments/call_with_leading_comma_error.phpt
index 1f587dd8f5..4067723a6f 100644
--- a/Zend/tests/function_arguments/call_with_leading_comma_error.phpt
+++ b/Zend/tests/function_arguments/call_with_leading_comma_error.phpt
@@ -5,4 +5,4 @@ Leading commas in function calls is not allowed
foo(,$foo);
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',' in %s on line %d
+Parse error: syntax error, unexpected token "," in %s on line %d
diff --git a/Zend/tests/function_arguments/call_with_multi_inner_comma_error.phpt b/Zend/tests/function_arguments/call_with_multi_inner_comma_error.phpt
index d8250536da..916ed7d4e5 100644
--- a/Zend/tests/function_arguments/call_with_multi_inner_comma_error.phpt
+++ b/Zend/tests/function_arguments/call_with_multi_inner_comma_error.phpt
@@ -5,4 +5,4 @@ Multiple inner commas in function calls is not allowed
foo($foo,,$bar);
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',', expecting ')' in %s on line %d
+Parse error: syntax error, unexpected token ",", expecting ")" in %s on line %d
diff --git a/Zend/tests/function_arguments/call_with_multi_trailing_comma_error.phpt b/Zend/tests/function_arguments/call_with_multi_trailing_comma_error.phpt
index a38a01644b..7e80b032a8 100644
--- a/Zend/tests/function_arguments/call_with_multi_trailing_comma_error.phpt
+++ b/Zend/tests/function_arguments/call_with_multi_trailing_comma_error.phpt
@@ -5,4 +5,4 @@ Multiple trailing commas in function calls is not allowed
foo($foo,,);
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',', expecting ')' in %s on line %d
+Parse error: syntax error, unexpected token ",", expecting ")" in %s on line %d
diff --git a/Zend/tests/function_arguments/call_with_only_comma_error.phpt b/Zend/tests/function_arguments/call_with_only_comma_error.phpt
index 8a0ce6810d..467a5be5c0 100644
--- a/Zend/tests/function_arguments/call_with_only_comma_error.phpt
+++ b/Zend/tests/function_arguments/call_with_only_comma_error.phpt
@@ -5,4 +5,4 @@ Single comma in function calls is not allowed
foo(,);
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',' in %s on line %d
+Parse error: syntax error, unexpected token "," in %s on line %d
diff --git a/Zend/tests/function_arguments/variadic_argument_type_error.phpt b/Zend/tests/function_arguments/variadic_argument_type_error.phpt
new file mode 100644
index 0000000000..9041aadcad
--- /dev/null
+++ b/Zend/tests/function_arguments/variadic_argument_type_error.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Call userland function with incorrect variadic argument type
+--FILE--
+<?php
+
+function foo($foo, int ...$bar) {}
+
+try {
+ foo(1, []);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ foo(1, 1, 1, []);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+?>
+--EXPECTF--
+foo(): Argument #2 must be of type int, array given, called in %s on line %d
+foo(): Argument #4 must be of type int, array given, called in %s on line %d
diff --git a/Zend/tests/function_arguments_003.phpt b/Zend/tests/function_arguments_003.phpt
index b882476d1d..aa7fd0a197 100644
--- a/Zend/tests/function_arguments_003.phpt
+++ b/Zend/tests/function_arguments_003.phpt
@@ -5,7 +5,7 @@ Function Argument Parsing #003
const a = 10;
function t1($a = 1 + 1, $b = 1 << 2, $c = "foo" . "bar", $d = a * 10) {
- var_dump($a, $b, $c, $d);
+ var_dump($a, $b, $c, $d);
}
t1();
diff --git a/Zend/tests/function_exists_basic.phpt b/Zend/tests/function_exists_basic.phpt
index 5832231551..a49b758981 100644
--- a/Zend/tests/function_exists_basic.phpt
+++ b/Zend/tests/function_exists_basic.phpt
@@ -3,7 +3,6 @@ function_exists function : basic functionality
--FILE--
<?php
/*
- * proto bool function_exists(string function_name)
* Function is implemented in Zend/zend_builtin_functions.c
*/
@@ -24,11 +23,10 @@ var_dump(function_exists('g'));
echo "Method: ";
Class C {
- static function f() {}
+ static function f() {}
}
var_dump(function_exists('C::f'));
?>
-===Done===
--EXPECT--
*** Testing function_exists() : basic functionality ***
Internal function: bool(true)
@@ -36,4 +34,3 @@ User defined function: bool(true)
Case sensitivity: bool(true)
Non existent function: bool(false)
Method: bool(false)
-===Done===
diff --git a/Zend/tests/function_outside_namespace.phpt b/Zend/tests/function_outside_namespace.phpt
new file mode 100644
index 0000000000..f63fb9f56a
--- /dev/null
+++ b/Zend/tests/function_outside_namespace.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Function declaration should not be allowed before namespace declaration
+--FILE--
+<?php
+
+function foo() {}
+
+namespace Bar;
+
+?>
+--EXPECTF--
+Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in %s on line %d
diff --git a/Zend/tests/gc_004.phpt b/Zend/tests/gc_004.phpt
index 1b6f70abe6..714ad6aa9b 100644
--- a/Zend/tests/gc_004.phpt
+++ b/Zend/tests/gc_004.phpt
@@ -14,10 +14,7 @@ echo "ok\n"
--EXPECT--
array(1) {
[0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
+ *RECURSION*
}
int(1)
ok
diff --git a/Zend/tests/gc_007.phpt b/Zend/tests/gc_007.phpt
index a018e4846d..d7a548aff9 100644
--- a/Zend/tests/gc_007.phpt
+++ b/Zend/tests/gc_007.phpt
@@ -15,10 +15,7 @@ echo "ok\n"
--EXPECT--
array(1) {
[0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
+ *RECURSION*
}
int(0)
int(1)
diff --git a/Zend/tests/gc_010.phpt b/Zend/tests/gc_010.phpt
index af2dda3fe1..756c8ebc2a 100644
--- a/Zend/tests/gc_010.phpt
+++ b/Zend/tests/gc_010.phpt
@@ -15,10 +15,7 @@ echo "ok\n"
--EXPECT--
array(1) {
[0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
+ *RECURSION*
}
int(1)
ok
diff --git a/Zend/tests/gc_011.phpt b/Zend/tests/gc_011.phpt
index d11d7b6b46..3c6731c547 100644
--- a/Zend/tests/gc_011.phpt
+++ b/Zend/tests/gc_011.phpt
@@ -5,10 +5,10 @@ zend.enable_gc=1
--FILE--
<?php
class Foo {
- public $a;
- function __destruct() {
- echo __FUNCTION__,"\n";
- }
+ public $a;
+ function __destruct() {
+ echo __FUNCTION__,"\n";
+ }
}
$a = new Foo();
$a->a = $a;
diff --git a/Zend/tests/gc_012.phpt b/Zend/tests/gc_012.phpt
index f6c8538979..4e924eda3b 100644
--- a/Zend/tests/gc_012.phpt
+++ b/Zend/tests/gc_012.phpt
@@ -6,13 +6,14 @@ zend.enable_gc=1
<?php
$a=array();
for ($i=0; $i < 1000; $i++) {
- $a[$i] = array(array());
- $a[$i][0] = & $a[$i];
+ $a[$i] = array(array());
+ $a[$i][0] = & $a[$i];
}
var_dump(gc_collect_cycles());
unset($a);
var_dump(gc_collect_cycles());
echo "ok\n";
+?>
--EXPECT--
int(0)
int(1000)
diff --git a/Zend/tests/gc_013.phpt b/Zend/tests/gc_013.phpt
index 0c5424086a..515d58b65e 100644
--- a/Zend/tests/gc_013.phpt
+++ b/Zend/tests/gc_013.phpt
@@ -6,7 +6,7 @@ zend.enable_gc=1
<?php
$a = array();
for ($i = 0; $i < 10001; $i++) {
- $a[$i] =& $a;
+ $a[$i] =& $a;
}
$a[] = "xxx";
unset($a);
diff --git a/Zend/tests/gc_014.phpt b/Zend/tests/gc_014.phpt
index 4fd8948af5..68fda48cc5 100644
--- a/Zend/tests/gc_014.phpt
+++ b/Zend/tests/gc_014.phpt
@@ -6,8 +6,8 @@ zend.enable_gc=1
<?php
$a = new stdClass();
for ($i = 0; $i < 10001; $i++) {
- $b =& $a;
- $a->{"a".$i} = $a;
+ $b =& $a;
+ $a->{"a".$i} = $a;
}
unset($b);
$a->b = "xxx";
diff --git a/Zend/tests/gc_016.phpt b/Zend/tests/gc_016.phpt
index 211f03a605..f28005e1bc 100644
--- a/Zend/tests/gc_016.phpt
+++ b/Zend/tests/gc_016.phpt
@@ -5,14 +5,14 @@ zend.enable_gc=1
--FILE--
<?php
class Foo {
- public $a;
- function __destruct() {
- echo "-> ";
- $a = array();
- $a[] =& $a;
- unset($a);
- var_dump(gc_collect_cycles());
- }
+ public $a;
+ function __destruct() {
+ echo "-> ";
+ $a = array();
+ $a[] =& $a;
+ unset($a);
+ var_dump(gc_collect_cycles());
+ }
}
$a = new Foo();
$a->a = $a;
diff --git a/Zend/tests/gc_017.phpt b/Zend/tests/gc_017.phpt
index 55f381992e..118da83413 100644
--- a/Zend/tests/gc_017.phpt
+++ b/Zend/tests/gc_017.phpt
@@ -5,23 +5,23 @@ zend.enable_gc=1
--FILE--
<?php
class Node {
- public $name;
- public $children;
- public $parent;
- function __construct($name) {
- $this->name = $name;
- $this->parent = null;
- }
- function insert($node) {
- $node->parent = $this;
- $this->children[] = $node;
- }
- function __destruct() {
- var_dump($this->name);
- unset($this->name);
- unset($this->children);
- unset($this->parent);
- }
+ public $name;
+ public $children;
+ public $parent;
+ function __construct($name) {
+ $this->name = $name;
+ $this->parent = null;
+ }
+ function insert($node) {
+ $node->parent = $this;
+ $this->children[] = $node;
+ }
+ function __destruct() {
+ var_dump($this->name);
+ unset($this->name);
+ unset($this->children);
+ unset($this->parent);
+ }
}
$a = new Node('A');
$b = new Node('B');
diff --git a/Zend/tests/gc_023.phpt b/Zend/tests/gc_023.phpt
index 6d6e1e6376..2a5d020655 100644
--- a/Zend/tests/gc_023.phpt
+++ b/Zend/tests/gc_023.phpt
@@ -6,21 +6,22 @@ zend.enable_gc=1
<?php
$a=array();
for ($i=0; $i < 9999; $i++) {
- $a[$i] = array(array());
- $a[$i][0] = & $a[$i];
+ $a[$i] = array(array());
+ $a[$i][0] = & $a[$i];
}
var_dump(gc_collect_cycles());
unset($a);
var_dump(gc_collect_cycles());
$a=array();
for ($i=0; $i < 10001; $i++) {
- $a[$i] = array(array());
- $a[$i][0] = & $a[$i];
+ $a[$i] = array(array());
+ $a[$i][0] = & $a[$i];
}
var_dump(gc_collect_cycles());
unset($a); // 10000 zvals collected automatic
var_dump(gc_collect_cycles());
echo "ok\n";
+?>
--EXPECT--
int(0)
int(9999)
diff --git a/Zend/tests/gc_027.phpt b/Zend/tests/gc_027.phpt
index d499cc314a..147ccf497f 100644
--- a/Zend/tests/gc_027.phpt
+++ b/Zend/tests/gc_027.phpt
@@ -5,10 +5,11 @@ zend.enable_gc=1
--FILE--
<?php
try {
- throw new Exception();
+ throw new Exception();
} catch (Exception $e) {
- gc_collect_cycles();
+ gc_collect_cycles();
}
echo "ok\n";
+?>
--EXPECT--
ok
diff --git a/Zend/tests/gc_028.phpt b/Zend/tests/gc_028.phpt
index fb2ea92c91..aabff91a3d 100644
--- a/Zend/tests/gc_028.phpt
+++ b/Zend/tests/gc_028.phpt
@@ -5,15 +5,15 @@ zend.enable_gc=1
--FILE--
<?php
class Foo {
- public $bar;
- function __destruct() {
- if ($this->bar !== null) {
- unset($this->bar);
- }
- }
+ public $bar;
+ function __destruct() {
+ if ($this->bar !== null) {
+ unset($this->bar);
+ }
+ }
}
class Bar {
- public $foo;
+ public $foo;
function __destruct() {
if ($this->foo !== null) {
unset($this->foo);
diff --git a/Zend/tests/gc_029.phpt b/Zend/tests/gc_029.phpt
index 89c55e5ba7..b5ecc8fff2 100644
--- a/Zend/tests/gc_029.phpt
+++ b/Zend/tests/gc_029.phpt
@@ -5,17 +5,17 @@ zend.enable_gc=1
--FILE--
<?php
class Foo {
- public $bar;
- public $x = array(1,2,3);
- function __destruct() {
- if ($this->bar !== null) {
- $this->x = null;
- unset($this->bar);
- }
- }
+ public $bar;
+ public $x = array(1,2,3);
+ function __destruct() {
+ if ($this->bar !== null) {
+ $this->x = null;
+ unset($this->bar);
+ }
+ }
}
class Bar {
- public $foo;
+ public $foo;
function __destruct() {
if ($this->foo !== null) {
unset($this->foo);
diff --git a/Zend/tests/gc_033.phpt b/Zend/tests/gc_033.phpt
index 1fd36976ad..cc28fd6a10 100644
--- a/Zend/tests/gc_033.phpt
+++ b/Zend/tests/gc_033.phpt
@@ -18,9 +18,9 @@ unset($a);
/* let's full the gc roots */
for ($i=0; $i<9999; $i++) {
- $b = range(0, 1);
- $b[0] = &$b;
- unset($b);
+ $b = range(0, 1);
+ $b[0] = &$b;
+ unset($b);
}
/* then $a will be freed, but $a->a[0] is not. reference to a freed $a */
diff --git a/Zend/tests/gc_035.phpt b/Zend/tests/gc_035.phpt
index 187af9108b..9118174ceb 100644
--- a/Zend/tests/gc_035.phpt
+++ b/Zend/tests/gc_035.phpt
@@ -5,11 +5,11 @@ zend.enable_gc = 1
--FILE--
<?php
class A {
- public $a;
- public $x;
- function __destruct() {
- unset($this->x);
- }
+ public $a;
+ public $x;
+ function __destruct() {
+ unset($this->x);
+ }
}
$a = new A;
$a->a = $a;
@@ -20,6 +20,7 @@ var_dump(gc_collect_cycles());
unset($a);
var_dump(gc_collect_cycles());
var_dump(gc_collect_cycles());
+?>
--EXPECT--
int(0)
int(0)
diff --git a/Zend/tests/gc_036.phpt b/Zend/tests/gc_036.phpt
index 67f9a45465..40b65987e2 100644
--- a/Zend/tests/gc_036.phpt
+++ b/Zend/tests/gc_036.phpt
@@ -5,12 +5,12 @@ zend.enable_gc = 1
--FILE--
<?php
function &foo() {
- $a = [];
- $a[] =& $a;
- return $a;
+ $a = [];
+ $a[] =& $a;
+ return $a;
}
function bar() {
- gc_collect_cycles();
+ gc_collect_cycles();
}
bar(foo());
echo "ok\n";
diff --git a/Zend/tests/gc_037.phpt b/Zend/tests/gc_037.phpt
index 268f8f184d..e046944ac1 100644
--- a/Zend/tests/gc_037.phpt
+++ b/Zend/tests/gc_037.phpt
@@ -11,6 +11,7 @@ var_dump(gc_status());
gc_collect_cycles();
gc_collect_cycles();
var_dump(gc_status());
+?>
--EXPECT--
array(4) {
["runs"]=>
diff --git a/Zend/tests/gc_038.phpt b/Zend/tests/gc_038.phpt
index 737025ae2d..91f22bf154 100644
--- a/Zend/tests/gc_038.phpt
+++ b/Zend/tests/gc_038.phpt
@@ -5,119 +5,141 @@ zend.enable_gc = 1
--FILE--
<?php
function test_add() {
- $x = new stdClass;
- $x->x= $x;
- @$x += 5;
- $n = gc_collect_cycles();
- echo "+=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x += 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo "+=\t$n\n";
}
test_add();
function test_sub() {
- $x = new stdClass;
- $x->x= $x;
- @$x -= 5;
- $n = gc_collect_cycles();
- echo "-=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x -= 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo "-=\t$n\n";
}
test_sub();
function test_mul() {
- $x = new stdClass;
- $x->x= $x;
- @$x *= 5;
- $n = gc_collect_cycles();
- echo "*=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x *= 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo "*=\t$n\n";
}
test_mul();
function test_div() {
- $x = new stdClass;
- $x->x= $x;
- @$x /= 5;
- $n = gc_collect_cycles();
- echo "/=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x /= 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo "/=\t$n\n";
}
test_div();
function test_mod() {
- $x = new stdClass;
- $x->x= $x;
- @$x %= 5;
- $n = gc_collect_cycles();
- echo "%=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x %= 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo "%=\t$n\n";
}
test_mod();
function test_sl() {
- $x = new stdClass;
- $x->x= $x;
- @$x <<= 5;
- $n = gc_collect_cycles();
- echo "<<=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x <<= 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo "<<=\t$n\n";
}
test_sl();
function test_sr() {
- $x = new stdClass;
- $x->x= $x;
- @$x >>= 5;
- $n = gc_collect_cycles();
- echo ">>=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x >>= 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo ">>=\t$n\n";
}
test_sr();
function test_or() {
- $x = new stdClass;
- $x->x= $x;
- @$x |= 1;
- $n = gc_collect_cycles();
- echo "|=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x |= 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo "|=\t$n\n";
}
test_or();
function test_and() {
- $x = new stdClass;
- $x->x= $x;
- @$x &= 1;
- $n = gc_collect_cycles();
- echo "&=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x &= 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo "&=\t$n\n";
}
test_and();
function test_xor() {
- $x = new stdClass;
- $x->x= $x;
- @$x ^= 1;
- $n = gc_collect_cycles();
- echo "^=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x ^= 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo "^=\t$n\n";
}
test_xor();
function test_pow() {
- $x = new stdClass;
- $x->x= $x;
- @$x **= 1;
- $n = gc_collect_cycles();
- echo "**=\t$n\n";
+ $x = new stdClass;
+ $x->x = $x;
+ try {
+ $x **= 5;
+ } catch (TypeError $e) { unset($x); }
+ $n = gc_collect_cycles();
+ echo "**=\t$n\n";
}
test_pow();
class Y {
- function __toString() {
- return "y";
- }
+ function __toString() {
+ return "y";
+ }
}
function test_concat() {
- $x = new Y;
- $x->x= $x;
- @$x .= "x";
- $n = gc_collect_cycles();
- echo ".=\t$n\n";
+ $x = new Y;
+ $x->x= $x;
+ @$x .= "x";
+ $n = gc_collect_cycles();
+ echo ".=\t$n\n";
}
test_concat();
?>
---EXPECT--
+--EXPECTF--
+= 1
-= 1
*= 1
diff --git a/Zend/tests/gc_041.phpt b/Zend/tests/gc_041.phpt
index fc849991e1..e5870286ba 100644
--- a/Zend/tests/gc_041.phpt
+++ b/Zend/tests/gc_041.phpt
@@ -5,11 +5,11 @@ zend.enable_gc = 1
--FILE--
<?php
class ryat {
- var $ryat;
+ var $ryat;
var $chtg;
var $nested;
- function __destruct() {
- $GLOBALS['x'] = $this;
+ function __destruct() {
+ $GLOBALS['x'] = $this;
}
}
$o = new ryat;
diff --git a/Zend/tests/gc_043.phpt b/Zend/tests/gc_043.phpt
new file mode 100644
index 0000000000..06b64de39a
--- /dev/null
+++ b/Zend/tests/gc_043.phpt
@@ -0,0 +1,44 @@
+--TEST--
+GC buffer shouldn't get reused when removing nested data
+--FILE--
+<?php
+$s = <<<'STR'
+O:8:"stdClass":2:{i:5;C:8:"SplStack":29:{i:4;:r:1;:O:8:"stdClass":0:{}}i:0;O:13:"RegexIterator":1:{i:5;C:8:"SplStack":29:{i:4;:r:1;:O:8:"stdClass":0:{}}}}
+STR;
+var_dump(unserialize($s));
+gc_collect_cycles();
+?>
+--EXPECT--
+object(stdClass)#1 (2) {
+ ["5"]=>
+ object(SplStack)#2 (2) {
+ ["flags":"SplDoublyLinkedList":private]=>
+ int(4)
+ ["dllist":"SplDoublyLinkedList":private]=>
+ array(2) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ object(stdClass)#3 (0) {
+ }
+ }
+ }
+ ["0"]=>
+ object(RegexIterator)#4 (2) {
+ ["replacement"]=>
+ NULL
+ ["5"]=>
+ object(SplStack)#5 (2) {
+ ["flags":"SplDoublyLinkedList":private]=>
+ int(4)
+ ["dllist":"SplDoublyLinkedList":private]=>
+ array(2) {
+ [0]=>
+ *RECURSION*
+ [1]=>
+ object(stdClass)#6 (0) {
+ }
+ }
+ }
+ }
+}
diff --git a/Zend/tests/generators/backtrace_multi_yield_from.phpt b/Zend/tests/generators/backtrace_multi_yield_from.phpt
new file mode 100644
index 0000000000..6627fe8458
--- /dev/null
+++ b/Zend/tests/generators/backtrace_multi_yield_from.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Generator backtrace with multi yield from
+--FILE--
+<?php
+
+function gen() {
+ yield 1;
+ debug_print_backtrace();
+ yield 2;
+}
+
+function from($gen) {
+ yield from $gen;
+}
+
+$gen1 = gen();
+$gen2 = from($gen1);
+$gen3 = from($gen2);
+var_dump($gen3->current());
+$gen2->next();
+var_dump($gen2->current());
+$gen2->next();
+var_dump($gen2->current());
+
+?>
+--EXPECTF--
+int(1)
+int(1)
+#0 gen() called at [%s:10]
+#1 from(Generator Object ())
+#2 Generator->next() called at [%s:19]
+int(2)
diff --git a/Zend/tests/generators/basic_yield_from_exception_handling.phpt b/Zend/tests/generators/basic_yield_from_exception_handling.phpt
index 6b622847cd..2b6b04513a 100644
--- a/Zend/tests/generators/basic_yield_from_exception_handling.phpt
+++ b/Zend/tests/generators/basic_yield_from_exception_handling.phpt
@@ -3,27 +3,27 @@ Exceptions in linear yield from setup
--FILE--
<?php
function from($off) {
- try {
- yield $off + 1;
- } catch (Exception $e) { print "catch in from()\n$e\n"; }
- yield $off + 2;
+ try {
+ yield $off + 1;
+ } catch (Exception $e) { print "catch in from()\n$e\n"; }
+ yield $off + 2;
}
function gen() {
- try {
- yield "gen" => 0;
- } catch (Exception $e) { print "catch in gen()\n$e\n"; }
- try {
- yield from from(0);
- } catch (Exception $e) { print "catch in gen()\n$e\n"; }
- yield from from(2);
+ try {
+ yield "gen" => 0;
+ } catch (Exception $e) { print "catch in gen()\n$e\n"; }
+ try {
+ yield from from(0);
+ } catch (Exception $e) { print "catch in gen()\n$e\n"; }
+ yield from from(2);
}
$i = 0;
try {
- for ($gen = gen(); $gen->valid(); $gen->throw(new Exception((string) $i++))) {
- var_dump($gen->current());
- }
+ for ($gen = gen(); $gen->valid(); $gen->throw(new Exception((string) $i++))) {
+ var_dump($gen->current());
+ }
} catch (Exception $e) { print "catch in {main}\n$e\n"; }
var_dump($gen->valid());
diff --git a/Zend/tests/generators/basic_yield_from_proxying.phpt b/Zend/tests/generators/basic_yield_from_proxying.phpt
index 74ffc5da80..ce9a09cba3 100644
--- a/Zend/tests/generators/basic_yield_from_proxying.phpt
+++ b/Zend/tests/generators/basic_yield_from_proxying.phpt
@@ -3,24 +3,24 @@ Basic test if yield from works
--FILE--
<?php
function from() {
- yield "from" => 1;
- yield 2;
+ yield "from" => 1;
+ yield 2;
}
function gen() {
- yield "gen" => 0;
- yield from from();
- yield 3;
+ yield "gen" => 0;
+ yield from from();
+ yield 3;
}
/* foreach API */
foreach (gen() as $k => $v) {
- var_dump($k, $v);
+ var_dump($k, $v);
}
/* iterator API */
for ($gen = gen(); $gen->valid(); $gen->next()) {
- var_dump($gen->key(), $gen->current());
+ var_dump($gen->key(), $gen->current());
}
?>
--EXPECT--
diff --git a/Zend/tests/generators/bug63066.phpt b/Zend/tests/generators/bug63066.phpt
index 3237c8a7a3..bf66904f2e 100644
--- a/Zend/tests/generators/bug63066.phpt
+++ b/Zend/tests/generators/bug63066.phpt
@@ -4,16 +4,17 @@ Bug #63066 (Calling an undefined method in a generator results in a seg fault)
<?php
function gen($o)
{
- yield 'foo';
- $o->fatalError();
+ yield 'foo';
+ $o->fatalError();
}
foreach(gen(new stdClass()) as $value)
- echo $value, "\n";
+ echo $value, "\n";
+?>
--EXPECTF--
foo
-Fatal error: Uncaught Error: Call to undefined method stdClass::fatalError() in %sbug63066.php:5
+Fatal error: Uncaught Error: Call to undefined method stdClass::fatalError() in %s:%d
Stack trace:
#0 %s(%d): gen(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/generators/bug65161.phpt b/Zend/tests/generators/bug65161.phpt
index ea0d65a857..63c915b885 100644
--- a/Zend/tests/generators/bug65161.phpt
+++ b/Zend/tests/generators/bug65161.phpt
@@ -19,8 +19,7 @@ foreach (testGenerator() as $i);
--EXPECTF--
Fatal error: Uncaught Error: Call to undefined function foo() in %s:%d
Stack trace:
-#0 [internal function]: autoload('SyntaxError')
-#1 %s(%d): spl_autoload_call('SyntaxError')
-#2 %s(%d): testGenerator()
-#3 {main}
+#0 %s(%d): autoload('SyntaxError')
+#1 %s(%d): testGenerator()
+#2 {main}
thrown in %s on line %d
diff --git a/Zend/tests/generators/bug67497.phpt b/Zend/tests/generators/bug67497.phpt
index edbd578da5..727847320b 100644
--- a/Zend/tests/generators/bug67497.phpt
+++ b/Zend/tests/generators/bug67497.phpt
@@ -9,7 +9,7 @@ function gen() {
}
try {
- eval('abc');
+ eval('abc');
} catch (ParseError $ex) {
}
diff --git a/Zend/tests/generators/bug70904.phpt b/Zend/tests/generators/bug70904.phpt
index cd00e0bb34..2fbbfe6918 100644
--- a/Zend/tests/generators/bug70904.phpt
+++ b/Zend/tests/generators/bug70904.phpt
@@ -4,13 +4,13 @@ Bug #70904 (yield from incorrectly marks valid generator as finished)
<?php
function g1() {
- yield 1;
+ yield 1;
}
function g2($g1) {
- yield from $g1;
- echo "reached!\n";
- yield 2;
+ yield from $g1;
+ echo "reached!\n";
+ yield 2;
}
$g1 = g1();
diff --git a/Zend/tests/generators/bug71297.phpt b/Zend/tests/generators/bug71297.phpt
index eed7278601..5d63135928 100644
--- a/Zend/tests/generators/bug71297.phpt
+++ b/Zend/tests/generators/bug71297.phpt
@@ -4,20 +4,20 @@ Bug #71297 (Memory leak with consecutive yield from)
<?php
function foo() {
- yield array_fill(0, 10000, 4);
+ yield array_fill(0, 10000, 4);
}
function genLeak() {
- $i = 0;
- while (1) {
- yield from foo();
- print $i++;
- }
+ $i = 0;
+ while (1) {
+ yield from foo();
+ print $i++;
+ }
}
$x = 0;
foreach (genLeak() as $i) {
- if ($x++ == 3) break;
+ if ($x++ == 3) break;
}
?>
diff --git a/Zend/tests/generators/bug71441.phpt b/Zend/tests/generators/bug71441.phpt
index 14395d2402..a0d270a05f 100644
--- a/Zend/tests/generators/bug71441.phpt
+++ b/Zend/tests/generators/bug71441.phpt
@@ -7,13 +7,13 @@ $num = 2000; /* to be sure to be in wild memory */
$add = str_repeat("1 +", $num);
$gen = (eval(<<<PHP
return function (): \Generator {
- try {
- \$a = 1;
- \$foo = \$a + $add \$a;
- return yield \$foo;
- } finally {
- print "Ok\n";
- }
+ try {
+ \$a = 1;
+ \$foo = \$a + $add \$a;
+ return yield \$foo;
+ } finally {
+ print "Ok\n";
+ }
};
PHP
))();
diff --git a/Zend/tests/generators/bug71601.phpt b/Zend/tests/generators/bug71601.phpt
index 09da2a5077..c8e226329d 100644
--- a/Zend/tests/generators/bug71601.phpt
+++ b/Zend/tests/generators/bug71601.phpt
@@ -4,22 +4,22 @@ Bug #71601 (finally block not executed after yield from)
<?php
function gen1() {
- try {
- yield 1;
- yield 2;
- return true;
- } finally {
- echo "Inner finally\n";
- }
+ try {
+ yield 1;
+ yield 2;
+ return true;
+ } finally {
+ echo "Inner finally\n";
+ }
}
function gen2() {
- try {
- echo "Entered try/catch\n";
- var_dump(yield from gen1());
- } finally {
- echo "Finally\n";
- }
+ try {
+ echo "Entered try/catch\n";
+ var_dump(yield from gen1());
+ } finally {
+ echo "Finally\n";
+ }
}
$generator = gen2();
diff --git a/Zend/tests/generators/bug72523.phpt b/Zend/tests/generators/bug72523.phpt
index 74dc583974..efce6f6936 100644
--- a/Zend/tests/generators/bug72523.phpt
+++ b/Zend/tests/generators/bug72523.phpt
@@ -4,9 +4,9 @@ Bug #72523 (dtrace issue with reflection (failed test))
<?php
$gen = (new class() {
- function a() {
- yield "okey";
- }
+ function a() {
+ yield "okey";
+ }
})->a();
var_dump($gen->current());
diff --git a/Zend/tests/generators/bug74157.phpt b/Zend/tests/generators/bug74157.phpt
index e5b9111f78..7033d82282 100644
--- a/Zend/tests/generators/bug74157.phpt
+++ b/Zend/tests/generators/bug74157.phpt
@@ -4,15 +4,15 @@ Bug #74157 (Segfault with nested generators)
<?php
function a() {
- $a = $b = $c = 2;
- foreach(range(1, 5) as $v) {
- yield $v;
- }
- return;
+ $a = $b = $c = 2;
+ foreach(range(1, 5) as $v) {
+ yield $v;
+ }
+ return;
}
foreach (a(range(1, 3)) as $a) {
- var_dump($a);
+ var_dump($a);
}
?>
--EXPECT--
diff --git a/Zend/tests/generators/bug74606.phpt b/Zend/tests/generators/bug74606.phpt
index cfb7f7f8cd..ec5ef26ee1 100644
--- a/Zend/tests/generators/bug74606.phpt
+++ b/Zend/tests/generators/bug74606.phpt
@@ -4,21 +4,21 @@ Bug #74606 (Segfault within try/catch/finally nesting in Generators)
<?php
function gen() {
- $array = ["foo"];
- $array[] = "bar";
+ $array = ["foo"];
+ $array[] = "bar";
- foreach ($array as $item) {
- try {
- try {
- yield;
- } finally {
- echo "fin $item\n";
- }
- } catch (\Exception $e) {
- echo "catch\n";
- continue;
- }
- }
+ foreach ($array as $item) {
+ try {
+ try {
+ yield;
+ } finally {
+ echo "fin $item\n";
+ }
+ } catch (\Exception $e) {
+ echo "catch\n";
+ continue;
+ }
+ }
}
gen()->throw(new Exception);
diff --git a/Zend/tests/generators/bug76427.phpt b/Zend/tests/generators/bug76427.phpt
index 53851b0f35..dbf466c2de 100644
--- a/Zend/tests/generators/bug76427.phpt
+++ b/Zend/tests/generators/bug76427.phpt
@@ -3,7 +3,7 @@ Bug #76427 (Segfault in zend_objects_store_put)
--FILE--
<?php
$func = function () {
- yield 2;
+ yield 2;
};
$a = new stdclass();
diff --git a/Zend/tests/generators/bug80240.phpt b/Zend/tests/generators/bug80240.phpt
new file mode 100644
index 0000000000..43cf3a94b5
--- /dev/null
+++ b/Zend/tests/generators/bug80240.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #80240: Use after free multi yield from
+--FILE--
+<?php
+
+function gen() {
+ yield 0;
+ yield from gen();
+}
+
+function bar($gen) {
+ yield from $gen;
+}
+
+$gen = gen();
+$a = bar($gen);
+$b = bar($gen);
+$a->rewind();
+$b->rewind();
+$a->next();
+unset($gen);
+unset($a);
+unset($b);
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/generators/dynamic_properties.phpt b/Zend/tests/generators/dynamic_properties.phpt
new file mode 100644
index 0000000000..08ceb7f581
--- /dev/null
+++ b/Zend/tests/generators/dynamic_properties.phpt
@@ -0,0 +1,19 @@
+--TEST--
+It's not possible to assign dynamic properties on a generator
+--FILE--
+<?php
+
+function gen() {
+ yield;
+}
+
+$gen = gen();
+try {
+ $gen->prop = new stdClass;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Cannot create dynamic property Generator::$prop
diff --git a/Zend/tests/generators/errors/count_error.phpt b/Zend/tests/generators/errors/count_error.phpt
index 97e03e7d71..b88902d841 100644
--- a/Zend/tests/generators/errors/count_error.phpt
+++ b/Zend/tests/generators/errors/count_error.phpt
@@ -9,10 +9,10 @@ $gen = gen();
try {
count($gen);
-} catch (Exception $e) {
- echo $e;
+} catch (\TypeError $e) {
+ echo $e->getMessage(), PHP_EOL;
}
?>
---EXPECTF--
-Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
+--EXPECT--
+count(): Argument #1 ($var) must be of type Countable|array, Generator given
diff --git a/Zend/tests/generators/errors/resume_running_generator_error.phpt b/Zend/tests/generators/errors/resume_running_generator_error.phpt
index 07dad42b01..53e8611cf3 100644
--- a/Zend/tests/generators/errors/resume_running_generator_error.phpt
+++ b/Zend/tests/generators/errors/resume_running_generator_error.phpt
@@ -6,11 +6,11 @@ It is not possible to resume an already running generator
function gen() {
$gen = yield;
try {
- $gen->next();
- } catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
- }
- $gen->next();
+ $gen->next();
+ } catch (Error $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+ }
+ $gen->next();
}
$gen = gen();
diff --git a/Zend/tests/generators/finally/return_yield.phpt b/Zend/tests/generators/finally/return_yield.phpt
index c4f3485987..07cfdfa79b 100644
--- a/Zend/tests/generators/finally/return_yield.phpt
+++ b/Zend/tests/generators/finally/return_yield.phpt
@@ -14,5 +14,6 @@ function foo($f, $t) {
foreach (foo(1, 5) as $x) {
echo $x, "\n";
}
+?>
--EXPECT--
1
diff --git a/Zend/tests/generators/finally/throw_yield.phpt b/Zend/tests/generators/finally/throw_yield.phpt
index 6d7d4f5d15..5b7845d605 100644
--- a/Zend/tests/generators/finally/throw_yield.phpt
+++ b/Zend/tests/generators/finally/throw_yield.phpt
@@ -14,6 +14,7 @@ function foo($f, $t) {
foreach (foo(1, 5) as $x) {
echo $x, "\n";
}
+?>
--EXPECTF--
1
diff --git a/Zend/tests/generators/finally/yield_return.phpt b/Zend/tests/generators/finally/yield_return.phpt
index e3e1bec357..6191f389e5 100644
--- a/Zend/tests/generators/finally/yield_return.phpt
+++ b/Zend/tests/generators/finally/yield_return.phpt
@@ -14,5 +14,6 @@ function foo($f, $t) {
foreach (foo(1, 5) as $x) {
echo $x, "\n";
}
+?>
--EXPECT--
1
diff --git a/Zend/tests/generators/finally/yield_throw.phpt b/Zend/tests/generators/finally/yield_throw.phpt
index e191ea0dc1..05b037c54f 100644
--- a/Zend/tests/generators/finally/yield_throw.phpt
+++ b/Zend/tests/generators/finally/yield_throw.phpt
@@ -14,6 +14,7 @@ function foo($f, $t) {
foreach (foo(1, 5) as $x) {
echo $x, "\n";
}
+?>
--EXPECTF--
1
diff --git a/Zend/tests/generators/finally/yield_yield.phpt b/Zend/tests/generators/finally/yield_yield.phpt
index 76610ef1a4..49ed943083 100644
--- a/Zend/tests/generators/finally/yield_yield.phpt
+++ b/Zend/tests/generators/finally/yield_yield.phpt
@@ -18,5 +18,6 @@ function foo() {
foreach (foo() as $x) {
echo $x;
}
+?>
--EXPECT--
1234567
diff --git a/Zend/tests/generators/gc_with_yield_from.phpt b/Zend/tests/generators/gc_with_yield_from.phpt
index 952352c853..68ec7ebe92 100644
--- a/Zend/tests/generators/gc_with_yield_from.phpt
+++ b/Zend/tests/generators/gc_with_yield_from.phpt
@@ -6,17 +6,17 @@ zend.enable_gc = 1
<?php
function root() {
- global $gens; // create cyclic reference to root
- try {
- yield 1;
- } finally {
- var_dump($gens);
- }
+ global $gens; // create cyclic reference to root
+ try {
+ yield 1;
+ } finally {
+ var_dump($gens);
+ }
}
function gen($x) {
- global $gens;
- yield from $gens[] = $x ? gen(--$x) : root();
+ global $gens;
+ yield from $gens[] = $x ? gen(--$x) : root();
}
$gen = $gens[] = gen(2);
diff --git a/Zend/tests/generators/generator_return_return_type.phpt b/Zend/tests/generators/generator_return_return_type.phpt
index 345e0065c2..2df8c7e110 100644
--- a/Zend/tests/generators/generator_return_return_type.phpt
+++ b/Zend/tests/generators/generator_return_return_type.phpt
@@ -4,9 +4,9 @@ Generators must return a valid variable with return type specified
<?php
$gen = (function (): Generator {
- 1 + $a = 1; // force a temporary
- return true;
- yield;
+ 1 + $a = 1; // force a temporary
+ return true;
+ yield;
})();
var_dump($gen->valid());
diff --git a/Zend/tests/generators/generator_return_without_value.phpt b/Zend/tests/generators/generator_return_without_value.phpt
index c507ebeb9c..3aed7feea0 100644
--- a/Zend/tests/generators/generator_return_without_value.phpt
+++ b/Zend/tests/generators/generator_return_without_value.phpt
@@ -14,12 +14,12 @@ function gen2() {
}
function gen3() {
- return;
+ return;
yield;
}
function gen4() {
- return;
+ return;
yield;
}
diff --git a/Zend/tests/generators/generator_returns_generator.phpt b/Zend/tests/generators/generator_returns_generator.phpt
index ad332a3be9..cdf9e06e69 100644
--- a/Zend/tests/generators/generator_returns_generator.phpt
+++ b/Zend/tests/generators/generator_returns_generator.phpt
@@ -6,7 +6,7 @@ A generator function returns a Generator object
function gen() {
// execution is suspended here, so the following never gets run:
echo "Foo";
- // trigger a generator
+ // trigger a generator
yield;
}
diff --git a/Zend/tests/generators/generator_symtable_leak.phpt b/Zend/tests/generators/generator_symtable_leak.phpt
index 7c736222d0..778b72479a 100644
--- a/Zend/tests/generators/generator_symtable_leak.phpt
+++ b/Zend/tests/generators/generator_symtable_leak.phpt
@@ -4,10 +4,10 @@ Generators using symtables must not leak
<?php
function gen() {
- $bar = ["some complex var"];
- ${"f"."oo"} = "force symtable usage";
- var_dump($bar);
- yield;
+ $bar = ["some complex var"];
+ ${"f"."oo"} = "force symtable usage";
+ var_dump($bar);
+ yield;
}
gen()->valid();
diff --git a/Zend/tests/generators/generator_with_type_check.phpt b/Zend/tests/generators/generator_with_type_check.phpt
index 12e6d46d76..67d19ab947 100644
--- a/Zend/tests/generators/generator_with_type_check.phpt
+++ b/Zend/tests/generators/generator_with_type_check.phpt
@@ -6,7 +6,7 @@ function gen(array $a) { yield; }
gen(42);
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to gen() must be of the type array, int given, called in %sgenerator_with_type_check.php on line 3 and defined in %sgenerator_with_type_check.php:2
+Fatal error: Uncaught TypeError: gen(): Argument #1 ($a) must be of type array, int given, called in %s:%d
Stack trace:
#0 %sgenerator_with_type_check.php(3): gen(42)
#1 {main}
diff --git a/Zend/tests/generators/generator_with_type_check_2.phpt b/Zend/tests/generators/generator_with_type_check_2.phpt
index ba1216224c..21e8ab8bed 100644
--- a/Zend/tests/generators/generator_with_type_check_2.phpt
+++ b/Zend/tests/generators/generator_with_type_check_2.phpt
@@ -4,19 +4,19 @@ Generator wit type check
<?php
function gen(array $a) { yield; }
try {
- gen(42);
+ gen(42);
} catch (TypeError $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
try {
- foreach (gen(42) as $val) {
- var_dump($val);
- }
+ foreach (gen(42) as $val) {
+ var_dump($val);
+ }
} catch (TypeError $e) {
echo $e->getMessage()."\n";
}
?>
--EXPECTF--
-Argument 1 passed to gen() must be of the type array, int given, called in %sgenerator_with_type_check_2.php on line 4
-Argument 1 passed to gen() must be of the type array, int given, called in %sgenerator_with_type_check_2.php on line 10
+gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d
+gen(): Argument #1 ($a) must be of type array, int given, called in %s on line %d
diff --git a/Zend/tests/generators/iterator_wrapper_leak.phpt b/Zend/tests/generators/iterator_wrapper_leak.phpt
new file mode 100644
index 0000000000..bc0f34e9c8
--- /dev/null
+++ b/Zend/tests/generators/iterator_wrapper_leak.phpt
@@ -0,0 +1,33 @@
+--TEST--
+A generator iterator wrapper involved in a cycle should not leak
+--FILE--
+<?php
+
+class Test {
+ public function method() {
+ $this->gen1 = (function () {
+ yield 1;
+ yield 2;
+ yield 3;
+ })();
+ $gen2 = function() {
+ foreach ($this->gen1 as $x) {
+ echo "$x\n";
+ yield $x;
+ }
+ };
+ $this->gen2 = $gen2();
+ foreach ($this->gen2 as $x) {
+ if ($x == 2) {
+ break;
+ }
+ }
+ }
+}
+(new Test)->method();
+gc_collect_cycles();
+
+?>
+--EXPECT--
+1
+2
diff --git a/Zend/tests/generators/multiple_yield_from_on_same_generator.phpt b/Zend/tests/generators/multiple_yield_from_on_same_generator.phpt
index 52dbea89b2..b0de7d32d1 100644
--- a/Zend/tests/generators/multiple_yield_from_on_same_generator.phpt
+++ b/Zend/tests/generators/multiple_yield_from_on_same_generator.phpt
@@ -4,16 +4,16 @@ Multiple yield from on a same Generator instance
<?php
function gen($a = 0) {
- yield 1 + $a;
- if ($a < 1) {
- var_dump(yield from gen($a + 1));
- }
- yield 3 + $a;
- return 5 + $a;
+ yield 1 + $a;
+ if ($a < 1) {
+ var_dump(yield from gen($a + 1));
+ }
+ yield 3 + $a;
+ return 5 + $a;
}
function bar($gen) {
- var_dump(yield from $gen);
+ var_dump(yield from $gen);
}
/* Twice a Generator from bar() using yield from on $gen */
@@ -22,10 +22,10 @@ $gens[] = bar($gen);
$gens[] = bar($gen);
do {
- foreach ($gens as $g) {
- var_dump($g->current());
- $g->next();
- }
+ foreach ($gens as $g) {
+ var_dump($g->current());
+ $g->next();
+ }
} while($gens[0]->valid());
var_dump($gens[1]->valid());
diff --git a/Zend/tests/generators/mutli_yield_from_with_exception.phpt b/Zend/tests/generators/mutli_yield_from_with_exception.phpt
index 4be2449a46..30b188515d 100644
--- a/Zend/tests/generators/mutli_yield_from_with_exception.phpt
+++ b/Zend/tests/generators/mutli_yield_from_with_exception.phpt
@@ -3,14 +3,14 @@ Multiple yield from on a same Generator throwing an Exception
--FILE--
<?php
function from() {
- yield 1;
- throw new Exception();
+ yield 1;
+ throw new Exception();
}
function gen($gen) {
- try {
- var_dump(yield from $gen);
- } catch (Exception $e) { print "Caught exception!\n$e\n"; }
+ try {
+ var_dump(yield from $gen);
+ } catch (Exception $e) { print "Caught exception!\n$e\n"; }
}
$gen = from();
@@ -18,15 +18,15 @@ $gens[] = gen($gen);
$gens[] = gen($gen);
foreach ($gens as $g) {
- $g->current(); // init.
+ $g->current(); // init.
}
do {
- foreach ($gens as $i => $g) {
- print "Generator $i\n";
- var_dump($g->current());
- $g->next();
- }
+ foreach ($gens as $i => $g) {
+ print "Generator $i\n";
+ var_dump($g->current());
+ $g->next();
+ }
} while($gens[0]->valid());
?>
--EXPECTF--
diff --git a/Zend/tests/generators/no_foreach_var_leaks.phpt b/Zend/tests/generators/no_foreach_var_leaks.phpt
index 62743895eb..c9d56b9fb7 100644
--- a/Zend/tests/generators/no_foreach_var_leaks.phpt
+++ b/Zend/tests/generators/no_foreach_var_leaks.phpt
@@ -4,9 +4,9 @@ foreach() (and other) variables aren't leaked on premature close
<?php
function gen(array $array) {
- foreach ($array as $value) {
- yield $value;
- }
+ foreach ($array as $value) {
+ yield $value;
+ }
}
$gen = gen(['Foo', 'Bar']);
diff --git a/Zend/tests/generators/recursive_yield_from.phpt b/Zend/tests/generators/recursive_yield_from.phpt
index 2fc1e0a591..535c92cea7 100644
--- a/Zend/tests/generators/recursive_yield_from.phpt
+++ b/Zend/tests/generators/recursive_yield_from.phpt
@@ -4,20 +4,20 @@ Check if recursion with yield from works
<?php
function from($a = 0) {
- yield 1 + $a;
- if ($a <= 3) {
- yield from from($a + 3);
- yield from from($a + 6);
- }
- yield 2 + $a;
+ yield 1 + $a;
+ if ($a <= 3) {
+ yield from from($a + 3);
+ yield from from($a + 6);
+ }
+ yield 2 + $a;
}
function gen() {
- yield from from();
+ yield from from();
}
foreach(gen() as $v) {
- var_dump($v);
+ var_dump($v);
}
?>
--EXPECT--
diff --git a/Zend/tests/generators/repeated_yield_from_with_immediate_release.phpt b/Zend/tests/generators/repeated_yield_from_with_immediate_release.phpt
new file mode 100644
index 0000000000..e6ab4e3c6c
--- /dev/null
+++ b/Zend/tests/generators/repeated_yield_from_with_immediate_release.phpt
@@ -0,0 +1,19 @@
+--TEST--
+A generator can be yielded from multiple times, testing immediate release of the yield from'ing generator
+--FILE--
+<?php
+
+function gen() {
+ yield 42;
+}
+function yield_from($gen) {
+ yield from $gen;
+}
+$gen = gen();
+var_dump(yield_from($gen)->current());
+var_dump(yield_from($gen)->current());
+
+?>
+--EXPECT--
+int(42)
+int(42)
diff --git a/Zend/tests/generators/throw_into_yield_from_array.phpt b/Zend/tests/generators/throw_into_yield_from_array.phpt
index b1571f6639..aa9fa82206 100644
--- a/Zend/tests/generators/throw_into_yield_from_array.phpt
+++ b/Zend/tests/generators/throw_into_yield_from_array.phpt
@@ -6,23 +6,23 @@ Throwing into a generator yielding from an array/iterator
$data = [1, 2, 3];
function yielditer($arr) {
- foreach($arr as $val) {
- yield $val;
- }
+ foreach($arr as $val) {
+ yield $val;
+ }
}
function yf($in) {
- yield from $in;
+ yield from $in;
}
function test($g) {
- var_dump($g->current());
- try {
- $g->throw(new Exception("Exception!"));
- } catch (Exception $e) {
- echo "{$e->getMessage()}\n";
- }
- var_dump($g->current());
+ var_dump($g->current());
+ try {
+ $g->throw(new Exception("Exception!"));
+ } catch (Exception $e) {
+ echo "{$e->getMessage()}\n";
+ }
+ var_dump($g->current());
}
$yfiter = yf($data);
diff --git a/Zend/tests/generators/throw_not_an_exception.phpt b/Zend/tests/generators/throw_not_an_exception.phpt
index 920d8eb847..3b5a590096 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(): Argument #1 ($exception) must be of type Throwable, stdClass 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/generators/xrange.phpt b/Zend/tests/generators/xrange.phpt
index 4d8b60fa90..3b8283e150 100644
--- a/Zend/tests/generators/xrange.phpt
+++ b/Zend/tests/generators/xrange.phpt
@@ -4,13 +4,13 @@ Simple generator xrange() test
<?php
function xrange($start, $end, $step = 1) {
- for ($i = $start; $i <= $end; $i += $step) {
- yield $i;
- }
+ for ($i = $start; $i <= $end; $i += $step) {
+ yield $i;
+ }
}
foreach (xrange(10, 20, 2) as $i) {
- var_dump($i);
+ var_dump($i);
}
?>
diff --git a/Zend/tests/generators/yield_during_function_call.phpt b/Zend/tests/generators/yield_during_function_call.phpt
index 21071f9fb4..9960e6d92b 100644
--- a/Zend/tests/generators/yield_during_function_call.phpt
+++ b/Zend/tests/generators/yield_during_function_call.phpt
@@ -4,7 +4,7 @@
<?php
function gen() {
- var_dump(str_repeat("x", yield));
+ var_dump(str_repeat("x", yield));
}
$gen = gen();
diff --git a/Zend/tests/generators/yield_from_aborted_generator_with_children.phpt b/Zend/tests/generators/yield_from_aborted_generator_with_children.phpt
new file mode 100644
index 0000000000..7074e40ab6
--- /dev/null
+++ b/Zend/tests/generators/yield_from_aborted_generator_with_children.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Impossible to yield from a generator which already failed, nested version
+--FILE--
+<?php
+
+function from() {
+ yield 0;
+ throw new Exception();
+}
+function gen($gen) {
+ yield from $gen;
+}
+
+$gen1 = from();
+$gen2 = gen($gen1);
+$gen3 = gen($gen1);
+try {
+ $gen2->next();
+} catch (Exception $e) {
+ unset($gen2);
+}
+$gen3->next();
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Generator passed to yield from was aborted without proper return and is unable to continue in %s:%d
+Stack trace:
+#0 [internal function]: gen(Object(Generator))
+#1 %s(%d): Generator->next()
+#2 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/generators/yield_from_already_running.phpt b/Zend/tests/generators/yield_from_already_running.phpt
index 5f2654dd6b..43b9542c72 100644
--- a/Zend/tests/generators/yield_from_already_running.phpt
+++ b/Zend/tests/generators/yield_from_already_running.phpt
@@ -4,7 +4,7 @@ Yielding from the already running Generator should fail (bug #69458)
<?php
function gen() {
- yield from yield;
+ yield from yield;
}
($gen = gen())->send($gen);
diff --git a/Zend/tests/generators/yield_from_array.phpt b/Zend/tests/generators/yield_from_array.phpt
index 1652ab2236..b1560170b1 100644
--- a/Zend/tests/generators/yield_from_array.phpt
+++ b/Zend/tests/generators/yield_from_array.phpt
@@ -3,17 +3,17 @@ yielding values from an array
--FILE--
<?php
function from() {
- yield 0;
- yield from []; // must not yield anything
- yield from [1,2];
+ yield 0;
+ yield from []; // must not yield anything
+ yield from [1,2];
}
function gen() {
- yield from from();
+ yield from from();
}
foreach(gen() as $v) {
- var_dump($v);
+ var_dump($v);
}
?>
--EXPECT--
diff --git a/Zend/tests/generators/yield_from_backtrace.phpt b/Zend/tests/generators/yield_from_backtrace.phpt
index e5d79723e7..8fb1aeef8c 100644
--- a/Zend/tests/generators/yield_from_backtrace.phpt
+++ b/Zend/tests/generators/yield_from_backtrace.phpt
@@ -3,26 +3,26 @@ Exceptions in linear yield from setup
--FILE--
<?php
function from($off) {
- debug_print_backtrace();
- yield $off + 1;
+ debug_print_backtrace();
+ yield $off + 1;
}
function gen() {
- yield 1;
- debug_print_backtrace();
- yield 2;
- yield from from(2);
- debug_print_backtrace();
+ yield 1;
+ debug_print_backtrace();
+ yield 2;
+ yield from from(2);
+ debug_print_backtrace();
}
print "\nImplicit foreach:\n";
foreach (gen() as $v) {
- var_dump($v);
+ var_dump($v);
}
print "\nExplicit iterator:\n";
for ($gen = gen(); $gen->valid(); $gen->next()) {
- var_dump($gen->current());
+ var_dump($gen->current());
}
?>
--EXPECTF--
diff --git a/Zend/tests/generators/yield_from_chain_dtor_order.phpt b/Zend/tests/generators/yield_from_chain_dtor_order.phpt
new file mode 100644
index 0000000000..9c336b3475
--- /dev/null
+++ b/Zend/tests/generators/yield_from_chain_dtor_order.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Leaf link may need to be invalidated depending on dtor order
+--FILE--
+<?php
+
+function gen2() {
+ yield 1;
+}
+function gen() {
+ yield from gen2();
+}
+function bar($g) {
+ yield from $g;
+}
+
+$gen = gen();
+$bar = bar($gen);
+var_dump($bar->current());
+$copy = $bar;
+unset($gen);
+
+?>
+--EXPECT--
+int(1)
diff --git a/Zend/tests/generators/yield_from_deep_recursion.phpt b/Zend/tests/generators/yield_from_deep_recursion.phpt
index 8ef3b89129..f6d6c3e79f 100644
--- a/Zend/tests/generators/yield_from_deep_recursion.phpt
+++ b/Zend/tests/generators/yield_from_deep_recursion.phpt
@@ -5,20 +5,20 @@ Deep recursion with yield from
ini_set("memory_limit", "512M");
function from($i) {
- yield $i;
+ yield $i;
}
function gen($i = 0) {
- if ($i < 50000) {
- yield from gen(++$i);
- } else {
- yield $i;
- yield from from(++$i);
- }
+ if ($i < 50000) {
+ yield from gen(++$i);
+ } else {
+ yield $i;
+ yield from from(++$i);
+ }
}
foreach (gen() as $v) {
- var_dump($v);
+ var_dump($v);
}
?>
--EXPECT--
diff --git a/Zend/tests/generators/yield_from_greedy_parse.phpt b/Zend/tests/generators/yield_from_greedy_parse.phpt
index 598fb515b4..ba41bd111c 100644
--- a/Zend/tests/generators/yield_from_greedy_parse.phpt
+++ b/Zend/tests/generators/yield_from_greedy_parse.phpt
@@ -19,6 +19,7 @@ function foo() {
foreach (foo() as $value) {
var_dump($value);
}
+?>
--EXPECT--
int(42)
int(24)
diff --git a/Zend/tests/generators/yield_from_iterator.phpt b/Zend/tests/generators/yield_from_iterator.phpt
index 959d6a2d33..162a4dd9e3 100644
--- a/Zend/tests/generators/yield_from_iterator.phpt
+++ b/Zend/tests/generators/yield_from_iterator.phpt
@@ -3,14 +3,14 @@ yield from with an (Array)Iterator
--FILE--
<?php
function g() {
- yield 1;
- yield from new ArrayIterator([2, 3, 4]);
- yield 5;
+ yield 1;
+ yield from new ArrayIterator([2, 3, 4]);
+ yield 5;
}
$g = g();
foreach ($g as $yielded) {
- var_dump($yielded);
+ var_dump($yielded);
}
?>
--EXPECT--
diff --git a/Zend/tests/generators/yield_from_multi_tree.phpt b/Zend/tests/generators/yield_from_multi_tree.phpt
index 808d693eae..bfa9033688 100644
--- a/Zend/tests/generators/yield_from_multi_tree.phpt
+++ b/Zend/tests/generators/yield_from_multi_tree.phpt
@@ -4,38 +4,38 @@ yield from on multiple trees needing merge
<?php
function from($levels) {
- foreach (range(0, 2 << $levels) as $v) {
- yield $v;
- }
+ foreach (range(0, 2 << $levels) as $v) {
+ yield $v;
+ }
}
function gen($gen, $level) {
- yield from $gen;
+ yield from $gen;
}
foreach (range(0, 6) as $levels) {
- print "$levels level".($levels == 1 ? "" : "s")."\n\n";
+ print "$levels level".($levels == 1 ? "" : "s")."\n\n";
- $all = array();
- $all[] = $gens[0][0] = from($levels);
+ $all = array();
+ $all[] = $gens[0][0] = from($levels);
- for ($level = 1; $level < $levels; $level++) {
- for ($i = 0; $i < (1 << $level); $i++) {
- $all[] = $gens[$level][$i] = gen($gens[$level-1][$i >> 1], $level);
- }
- }
+ for ($level = 1; $level < $levels; $level++) {
+ for ($i = 0; $i < (1 << $level); $i++) {
+ $all[] = $gens[$level][$i] = gen($gens[$level-1][$i >> 1], $level);
+ }
+ }
- while (1) {
- foreach ($all as $gen) {
- var_dump($gen->current());
- $gen->next();
- if (!$gen->valid()) {
- break 2;
- }
- }
- }
+ while (1) {
+ foreach ($all as $gen) {
+ var_dump($gen->current());
+ $gen->next();
+ if (!$gen->valid()) {
+ break 2;
+ }
+ }
+ }
- print "\n\n";
+ print "\n\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/generators/yield_from_multi_tree_exception.phpt b/Zend/tests/generators/yield_from_multi_tree_exception.phpt
index 4ff2e4e41f..cb8aedfd32 100644
--- a/Zend/tests/generators/yield_from_multi_tree_exception.phpt
+++ b/Zend/tests/generators/yield_from_multi_tree_exception.phpt
@@ -4,16 +4,16 @@ yield from on multiple trees needing merge
<?php
function from($levels) {
- foreach (range(0, 2 << $levels) as $v) {
- yield $v;
- if ($v == (1 << ($levels - 1)) - 2) {
- throw new Exception();
- }
- }
+ foreach (range(0, 2 << $levels) as $v) {
+ yield $v;
+ if ($v == (1 << ($levels - 1)) - 2) {
+ throw new Exception();
+ }
+ }
}
function gen($gen, $level) {
- yield from $gen;
+ yield from $gen;
}
$levels = 5;
@@ -24,24 +24,24 @@ $all = array();
$all[] = $gens[0][0] = from($levels);
for ($level = 1; $level < $levels; $level++) {
- for ($i = 0; $i < (1 << $level); $i++) {
- $all[] = $gens[$level][$i] = gen($gens[$level-1][$i >> 1], $level);
- }
+ for ($i = 0; $i < (1 << $level); $i++) {
+ $all[] = $gens[$level][$i] = gen($gens[$level-1][$i >> 1], $level);
+ }
}
for ($i = 0; $i < 2; $i++) {
- try {
- foreach ($all as $gen) {
- var_dump($gen->current());
- $gen->next();
- if (!$gen->valid()) {
- break;
- }
- }
- } catch(Exception $e) {
- print "$e\n";
- unset($all[array_search($gen, $all)]);
- }
+ try {
+ foreach ($all as $gen) {
+ var_dump($gen->current());
+ $gen->next();
+ if (!$gen->valid()) {
+ break;
+ }
+ }
+ } catch(Exception $e) {
+ print "$e\n";
+ unset($all[array_search($gen, $all)]);
+ }
}
?>
--EXPECTF--
diff --git a/Zend/tests/generators/yield_from_multi_tree_single_nodes.phpt b/Zend/tests/generators/yield_from_multi_tree_single_nodes.phpt
new file mode 100644
index 0000000000..2d78ffdc68
--- /dev/null
+++ b/Zend/tests/generators/yield_from_multi_tree_single_nodes.phpt
@@ -0,0 +1,328 @@
+--TEST--
+yield from on multiple trees needing merge, with intermediary nodes having only one child
+--FILE--
+<?php
+
+function from($levels) {
+ foreach (range(0, 2 << $levels) as $v) {
+ yield $v;
+ }
+}
+
+function gen($gen, $level) {
+ yield from (function() use ($gen) { yield from $gen; })();
+}
+
+foreach (range(0, 6) as $levels) {
+ print "$levels level".($levels == 1 ? "" : "s")."\n\n";
+
+ $all = array();
+ $all[] = $gens[0][0] = from($levels);
+
+ for ($level = 1; $level < $levels; $level++) {
+ for ($i = 0; $i < (1 << $level); $i++) {
+ $all[] = $gens[$level][$i] = gen($gens[$level-1][$i >> 1], $level);
+ }
+ }
+
+ while (1) {
+ foreach ($all as $gen) {
+ var_dump($gen->current());
+ $gen->next();
+ if (!$gen->valid()) {
+ break 2;
+ }
+ }
+ }
+
+ print "\n\n";
+}
+?>
+--EXPECT--
+0 levels
+
+int(0)
+int(1)
+int(2)
+
+
+1 level
+
+int(0)
+int(1)
+int(2)
+int(3)
+int(4)
+
+
+2 levels
+
+int(0)
+int(1)
+int(2)
+int(3)
+int(4)
+int(5)
+int(6)
+int(7)
+int(8)
+
+
+3 levels
+
+int(0)
+int(1)
+int(2)
+int(3)
+int(4)
+int(5)
+int(6)
+int(7)
+int(8)
+int(9)
+int(10)
+int(11)
+int(12)
+int(13)
+int(14)
+int(15)
+int(16)
+
+
+4 levels
+
+int(0)
+int(1)
+int(2)
+int(3)
+int(4)
+int(5)
+int(6)
+int(7)
+int(8)
+int(9)
+int(10)
+int(11)
+int(12)
+int(13)
+int(14)
+int(15)
+int(16)
+int(17)
+int(18)
+int(19)
+int(20)
+int(21)
+int(22)
+int(23)
+int(24)
+int(25)
+int(26)
+int(27)
+int(28)
+int(29)
+int(30)
+int(31)
+int(32)
+
+
+5 levels
+
+int(0)
+int(1)
+int(2)
+int(3)
+int(4)
+int(5)
+int(6)
+int(7)
+int(8)
+int(9)
+int(10)
+int(11)
+int(12)
+int(13)
+int(14)
+int(15)
+int(16)
+int(17)
+int(18)
+int(19)
+int(20)
+int(21)
+int(22)
+int(23)
+int(24)
+int(25)
+int(26)
+int(27)
+int(28)
+int(29)
+int(30)
+int(31)
+int(32)
+int(33)
+int(34)
+int(35)
+int(36)
+int(37)
+int(38)
+int(39)
+int(40)
+int(41)
+int(42)
+int(43)
+int(44)
+int(45)
+int(46)
+int(47)
+int(48)
+int(49)
+int(50)
+int(51)
+int(52)
+int(53)
+int(54)
+int(55)
+int(56)
+int(57)
+int(58)
+int(59)
+int(60)
+int(61)
+int(62)
+int(63)
+int(64)
+
+
+6 levels
+
+int(0)
+int(1)
+int(2)
+int(3)
+int(4)
+int(5)
+int(6)
+int(7)
+int(8)
+int(9)
+int(10)
+int(11)
+int(12)
+int(13)
+int(14)
+int(15)
+int(16)
+int(17)
+int(18)
+int(19)
+int(20)
+int(21)
+int(22)
+int(23)
+int(24)
+int(25)
+int(26)
+int(27)
+int(28)
+int(29)
+int(30)
+int(31)
+int(32)
+int(33)
+int(34)
+int(35)
+int(36)
+int(37)
+int(38)
+int(39)
+int(40)
+int(41)
+int(42)
+int(43)
+int(44)
+int(45)
+int(46)
+int(47)
+int(48)
+int(49)
+int(50)
+int(51)
+int(52)
+int(53)
+int(54)
+int(55)
+int(56)
+int(57)
+int(58)
+int(59)
+int(60)
+int(61)
+int(62)
+int(63)
+int(64)
+int(65)
+int(66)
+int(67)
+int(68)
+int(69)
+int(70)
+int(71)
+int(72)
+int(73)
+int(74)
+int(75)
+int(76)
+int(77)
+int(78)
+int(79)
+int(80)
+int(81)
+int(82)
+int(83)
+int(84)
+int(85)
+int(86)
+int(87)
+int(88)
+int(89)
+int(90)
+int(91)
+int(92)
+int(93)
+int(94)
+int(95)
+int(96)
+int(97)
+int(98)
+int(99)
+int(100)
+int(101)
+int(102)
+int(103)
+int(104)
+int(105)
+int(106)
+int(107)
+int(108)
+int(109)
+int(110)
+int(111)
+int(112)
+int(113)
+int(114)
+int(115)
+int(116)
+int(117)
+int(118)
+int(119)
+int(120)
+int(121)
+int(122)
+int(123)
+int(124)
+int(125)
+int(126)
+int(127)
+int(128)
diff --git a/Zend/tests/generators/yield_unary_precedence.phpt b/Zend/tests/generators/yield_unary_precedence.phpt
index 54eb0feb5f..3ebeed2d8c 100644
--- a/Zend/tests/generators/yield_unary_precedence.phpt
+++ b/Zend/tests/generators/yield_unary_precedence.phpt
@@ -3,14 +3,14 @@ When + or - are used on yield, they must be unary (and not binary) (Bug #69160)
--FILE--
<?php
function gen() {
- var_dump(yield +1);
- var_dump(yield -1);
- var_dump(yield * -1); // other ops still should behave normally
+ var_dump(yield +1);
+ var_dump(yield -1);
+ var_dump(yield * -1); // other ops still should behave normally
}
for ($gen = gen(); $gen->valid(); $gen->send(1)) {
- echo "\n";
- var_dump($gen->current());
+ echo "\n";
+ var_dump($gen->current());
}
?>
--EXPECT--
diff --git a/Zend/tests/get_called_class_001.phpt b/Zend/tests/get_called_class_001.phpt
index 7012ae8129..caa6d154d9 100644
--- a/Zend/tests/get_called_class_001.phpt
+++ b/Zend/tests/get_called_class_001.phpt
@@ -3,9 +3,12 @@ Calling get_called_class() outside a class
--FILE--
<?php
-var_dump(get_called_class());
+try {
+ var_dump(get_called_class());
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: get_called_class() called from outside a class in %s on line %d
-bool(false)
+--EXPECT--
+get_called_class() must be called from within a class
diff --git a/Zend/tests/get_class_methods_001.phpt b/Zend/tests/get_class_methods_001.phpt
index d0d51220aa..3ec51f1bcd 100644
--- a/Zend/tests/get_class_methods_001.phpt
+++ b/Zend/tests/get_class_methods_001.phpt
@@ -4,18 +4,18 @@ get_class_methods(): Testing scope
<?php
abstract class X {
- public function a() { }
- private function b() { }
- protected function c() { }
+ public function a() { }
+ private function b() { }
+ protected function c() { }
}
class Y extends X {
- private function bb() { }
+ private function bb() { }
- static public function test() {
- var_dump(get_class_methods('X'));
- var_dump(get_class_methods('Y'));
- }
+ static public function test() {
+ var_dump(get_class_methods('X'));
+ var_dump(get_class_methods('Y'));
+ }
}
diff --git a/Zend/tests/get_class_methods_002.phpt b/Zend/tests/get_class_methods_002.phpt
index c049c1ced3..27bcd7be38 100644
--- a/Zend/tests/get_class_methods_002.phpt
+++ b/Zend/tests/get_class_methods_002.phpt
@@ -4,20 +4,20 @@ get_class_methods(): Testing with interface
<?php
interface A {
- function a();
- function b();
+ function a();
+ function b();
}
class B implements A {
- public function a() { }
- public function b() { }
+ public function a() { }
+ public function b() { }
- public function __construct() {
- var_dump(get_class_methods('A'));
- var_dump(get_class_methods('B'));
- }
+ public function __construct() {
+ var_dump(get_class_methods('A'));
+ var_dump(get_class_methods('B'));
+ }
- public function __destruct() { }
+ public function __destruct() { }
}
new B;
diff --git a/Zend/tests/get_class_methods_003.phpt b/Zend/tests/get_class_methods_003.phpt
index 982b7cbc0f..966d6cee65 100644
--- a/Zend/tests/get_class_methods_003.phpt
+++ b/Zend/tests/get_class_methods_003.phpt
@@ -4,34 +4,34 @@ get_class_methods(): Testing scope
<?php
interface I {
- function aa();
- function bb();
- static function cc();
+ function aa();
+ function bb();
+ static function cc();
}
class X {
- public function a() { }
- protected function b() { }
- private function c() { }
+ public function a() { }
+ protected function b() { }
+ private function c() { }
- static public function static_a() { }
- static protected function static_b() { }
- static private function static_c() { }
+ static public function static_a() { }
+ static protected function static_b() { }
+ static private function static_c() { }
}
class Y extends X implements I {
- public function aa() { }
- public function bb() { }
+ public function aa() { }
+ public function bb() { }
- static function cc() { }
+ static function cc() { }
- public function __construct() {
- var_dump(get_class_methods('I'));
- var_dump(get_class_methods('Y'));
- var_dump(get_class_methods('X'));
- }
+ public function __construct() {
+ var_dump(get_class_methods('I'));
+ var_dump(get_class_methods('Y'));
+ var_dump(get_class_methods('X'));
+ }
- public function __destruct() { }
+ public function __destruct() { }
}
new Y;
diff --git a/Zend/tests/get_class_vars_001.phpt b/Zend/tests/get_class_vars_001.phpt
index ada0be6dad..84f502610e 100644
--- a/Zend/tests/get_class_vars_001.phpt
+++ b/Zend/tests/get_class_vars_001.phpt
@@ -4,21 +4,27 @@ get_class_vars(): Simple test
<?php
class A {
- public $a = 1;
- private $b = 2;
- private $c = 3;
+ public $a = 1;
+ private $b = 2;
+ private $c = 3;
}
class B extends A {
- static public $aa = 4;
- static private $bb = 5;
- static protected $cc = 6;
+ static public $aa = 4;
+ static private $bb = 5;
+ static protected $cc = 6;
}
var_dump(get_class_vars('A'));
var_dump(get_class_vars('B'));
+try {
+ get_class_vars("Unknown");
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
?>
--EXPECT--
array(1) {
@@ -31,3 +37,4 @@ array(2) {
["aa"]=>
int(4)
}
+get_class_vars(): Argument #1 ($class) must be a valid class name, Unknown given
diff --git a/Zend/tests/get_class_vars_002.phpt b/Zend/tests/get_class_vars_002.phpt
index 23531e458d..5aa0c4092d 100644
--- a/Zend/tests/get_class_vars_002.phpt
+++ b/Zend/tests/get_class_vars_002.phpt
@@ -4,24 +4,24 @@ get_class_vars(): Testing the scope
<?php
class A {
- public $a = 1;
- private $b = 2;
- private $c = 3;
+ public $a = 1;
+ private $b = 2;
+ private $c = 3;
}
class B extends A {
- static public $aa = 4;
- static private $bb = 5;
- static protected $cc = 6;
+ static public $aa = 4;
+ static private $bb = 5;
+ static protected $cc = 6;
}
class C extends B {
- public function __construct() {
- var_dump(get_class_vars('A'));
- var_dump(get_class_vars('B'));
+ public function __construct() {
+ var_dump(get_class_vars('A'));
+ var_dump(get_class_vars('B'));
- var_dump($this->a, $this->b, $this->c);
- }
+ var_dump($this->a, $this->b, $this->c);
+ }
}
new C;
@@ -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/get_class_vars_003.phpt b/Zend/tests/get_class_vars_003.phpt
index 5fe9f9971b..5659a49704 100644
--- a/Zend/tests/get_class_vars_003.phpt
+++ b/Zend/tests/get_class_vars_003.phpt
@@ -4,29 +4,29 @@ get_class_vars(): Testing the scope
<?php
class A {
- public $a = 1;
- private $b = 2;
- private $c = 3;
+ public $a = 1;
+ private $b = 2;
+ private $c = 3;
}
class B extends A {
- static public $aa = 4;
- static private $bb = 5;
- static protected $cc = 6;
+ static public $aa = 4;
+ static private $bb = 5;
+ static protected $cc = 6;
- protected function __construct() {
- var_dump(get_class_vars('C'));
- }
+ protected function __construct() {
+ var_dump(get_class_vars('C'));
+ }
}
class C extends B {
- public $aaa = 7;
- private $bbb = 8;
- protected $ccc = 9;
+ public $aaa = 7;
+ private $bbb = 8;
+ protected $ccc = 9;
- public function __construct() {
- parent::__construct();
- }
+ public function __construct() {
+ parent::__construct();
+ }
}
new C;
diff --git a/Zend/tests/get_class_vars_004.phpt b/Zend/tests/get_class_vars_004.phpt
index 9b21d165e1..d563ce65c1 100644
--- a/Zend/tests/get_class_vars_004.phpt
+++ b/Zend/tests/get_class_vars_004.phpt
@@ -4,22 +4,22 @@ get_class_vars(): Testing the scope
<?php
class A {
- public $a = 1;
- static public $A = 2;
+ public $a = 1;
+ static public $A = 2;
- private $b = 3;
- static private $B = 4;
+ private $b = 3;
+ static private $B = 4;
- protected $c = 5;
- static protected $C = 6;
+ protected $c = 5;
+ static protected $C = 6;
- public function __construct() {
- var_dump(get_class_vars('A'));
- }
+ public function __construct() {
+ var_dump(get_class_vars('A'));
+ }
- static public function test() {
- var_dump(get_class_vars('A'));
- }
+ static public function test() {
+ var_dump(get_class_vars('A'));
+ }
}
var_dump(get_class_vars('A'));
diff --git a/Zend/tests/get_class_vars_005.phpt b/Zend/tests/get_class_vars_005.phpt
index 47d28ca336..f2d98e76d4 100644
--- a/Zend/tests/get_class_vars_005.phpt
+++ b/Zend/tests/get_class_vars_005.phpt
@@ -4,16 +4,16 @@ get_class_vars(): Testing visibility
<?php
class A {
- protected $a = 1;
- private $b = 2;
+ protected $a = 1;
+ private $b = 2;
}
class B extends A {
- private $c = 3;
- public function __construct() {
- var_dump(get_class_vars('A'));
- var_dump(get_class_vars('B'));
- }
+ private $c = 3;
+ public function __construct() {
+ var_dump(get_class_vars('A'));
+ var_dump(get_class_vars('B'));
+ }
}
var_dump(get_class_vars('A'));
diff --git a/Zend/tests/get_class_vars_006.phpt b/Zend/tests/get_class_vars_006.phpt
index 34da051fd5..3b037fe27f 100644
--- a/Zend/tests/get_class_vars_006.phpt
+++ b/Zend/tests/get_class_vars_006.phpt
@@ -4,7 +4,7 @@ get_class_vars(): Testing visibility
<?php
class A {
- protected $a = 1;
+ protected $a = 1;
}
class B extends A { }
@@ -18,11 +18,11 @@ var_dump(get_class_vars('C'));
print "---\n";
class D extends B {
- public function __construct() {
- var_dump(get_class_vars('A'));
- var_dump(get_class_vars('B'));
- var_dump(get_class_vars('C'));
- }
+ public function __construct() {
+ var_dump(get_class_vars('A'));
+ var_dump(get_class_vars('B'));
+ var_dump(get_class_vars('C'));
+ }
}
new D;
diff --git a/Zend/tests/get_class_vars_007.phpt b/Zend/tests/get_class_vars_007.phpt
index 6aea0e2483..c73ddec492 100644
--- a/Zend/tests/get_class_vars_007.phpt
+++ b/Zend/tests/get_class_vars_007.phpt
@@ -4,13 +4,13 @@ get_class_vars(): Testing with static properties
<?php
class A {
- static public $a, $aa;
- static private $b, $bb;
- static protected $c, $cc;
+ static public $a, $aa;
+ static private $b, $bb;
+ static protected $c, $cc;
- static public function test() {
- var_dump(get_class_vars(__CLASS__));
- }
+ static public function test() {
+ var_dump(get_class_vars(__CLASS__));
+ }
}
var_dump(get_class_vars('A'));
diff --git a/Zend/tests/get_defined_functions_basic.phpt b/Zend/tests/get_defined_functions_basic.phpt
index f782b90892..5069275b0e 100644
--- a/Zend/tests/get_defined_functions_basic.phpt
+++ b/Zend/tests/get_defined_functions_basic.phpt
@@ -3,11 +3,6 @@ get_defined_functions() function : basic functionality
--FILE--
<?php
-/* Prototype : array get_defined_functions ( void )
- * Description: Gets an array of all defined functions.
- * Source code: Zend/zend_builtin_functions.c
-*/
-
echo "*** Testing get_defined_functions() : basic functionality ***\n";
function foo() {}
@@ -16,44 +11,42 @@ function foo() {}
function HelloWorld() {}
Class C {
- function f1() {}
- static function f2() {}
+ function f1() {}
+ static function f2() {}
}
$func = get_defined_functions();
if (!is_array($func)) {
- echo "TEST FAILED: return type not an array\n";
+ echo "TEST FAILED: return type not an array\n";
}
if (!is_array($func["internal"])) {
- echo "TEST FAILED: no element in result array with key 'internal'\n";
+ echo "TEST FAILED: no element in result array with key 'internal'\n";
}
$internal = $func["internal"];
//check for a few core functions
if (!in_array("cos", $internal) || !in_array("strlen", $internal)) {
- echo "TEST FAILED: missing elements from 'internal' array\n";
- var_dump($internal);
+ echo "TEST FAILED: missing elements from 'internal' array\n";
+ var_dump($internal);
}
if (!is_array($func["user"])) {
- echo "TEST FAILED: no element in result array with key 'user'\n";
+ echo "TEST FAILED: no element in result array with key 'user'\n";
}
$user = $func["user"];
if (count($user) == 2 && in_array("foo", $user) && in_array("helloworld", $user)) {
- echo "TEST PASSED\n";
+ echo "TEST PASSED\n";
} else {
- echo "TEST FAILED: missing elements from 'user' array\n";
- var_dump($user);
+ echo "TEST FAILED: missing elements from 'user' array\n";
+ var_dump($user);
}
?>
-===Done===
--EXPECT--
*** Testing get_defined_functions() : basic functionality ***
TEST PASSED
-===Done===
diff --git a/Zend/tests/get_defined_vars.phpt b/Zend/tests/get_defined_vars.phpt
index 8fe32c8937..bfd3164477 100644
--- a/Zend/tests/get_defined_vars.phpt
+++ b/Zend/tests/get_defined_vars.phpt
@@ -2,10 +2,6 @@
Testing get_defined_vars() Function
--FILE--
<?php
-/* Prototype: array get_defined_vars(void);
- * Description: Returns a multidimensional array of all defined variables.
- */
-
/* Various variables definitions used for testing of the function */
$number = 22.33; //number
diff --git a/Zend/tests/get_parent_class_001.phpt b/Zend/tests/get_parent_class_001.phpt
index 95395f935b..fefcbeb683 100644
--- a/Zend/tests/get_parent_class_001.phpt
+++ b/Zend/tests/get_parent_class_001.phpt
@@ -4,19 +4,19 @@ Testing get_parent_class()
<?php
interface ITest {
- function foo();
+ function foo();
}
abstract class bar implements ITest {
- public function foo() {
- var_dump(get_parent_class());
- }
+ public function foo() {
+ var_dump(get_parent_class());
+ }
}
class foo extends bar {
- public function __construct() {
- var_dump(get_parent_class());
- }
+ public function __construct() {
+ var_dump(get_parent_class());
+ }
}
$a = new foo;
diff --git a/Zend/tests/get_resource_id.phpt b/Zend/tests/get_resource_id.phpt
new file mode 100644
index 0000000000..70b3995d46
--- /dev/null
+++ b/Zend/tests/get_resource_id.phpt
@@ -0,0 +1,18 @@
+--TEST--
+get_resource_id() function
+--FILE--
+<?php
+
+$file = fopen(__FILE__, 'r');
+
+// get_resource_id() is equivalent to an integer cast.
+var_dump(get_resource_id($file) === (int) $file);
+
+// Also works with closed resources.
+fclose($file);
+var_dump(get_resource_id($file) === (int) $file);
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
diff --git a/Zend/tests/globals_001.phpt b/Zend/tests/globals_001.phpt
index 9a9c5401fe..069e88730c 100644
--- a/Zend/tests/globals_001.phpt
+++ b/Zend/tests/globals_001.phpt
@@ -26,9 +26,9 @@ string(5) "array"
int(%d)
string(%d) "%s"
-Notice: Undefined index: PHP_SELF in %s on line %d
+Warning: Undefined array key "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..d8f9ad4aa2 100644
--- a/Zend/tests/globals_002.phpt
+++ b/Zend/tests/globals_002.phpt
@@ -5,17 +5,17 @@ variables_order="egpcs"
--FILE--
<?php
function test() {
- var_dump(isset($_SERVER));
- var_dump(empty($_SERVER));
- var_dump(gettype($_SERVER));
- var_dump(count($_SERVER));
+ var_dump(isset($_SERVER));
+ var_dump(empty($_SERVER));
+ var_dump(gettype($_SERVER));
+ var_dump(count($_SERVER));
- var_dump($_SERVER['PHP_SELF']);
- unset($_SERVER['PHP_SELF']);
- var_dump($_SERVER['PHP_SELF']);
+ var_dump($_SERVER['PHP_SELF']);
+ unset($_SERVER['PHP_SELF']);
+ var_dump($_SERVER['PHP_SELF']);
- unset($_SERVER);
- var_dump($_SERVER);
+ unset($_SERVER);
+ var_dump($_SERVER);
}
test();
@@ -29,9 +29,9 @@ string(5) "array"
int(%d)
string(%d) "%s"
-Notice: Undefined index: PHP_SELF in %s on line %d
+Warning: Undefined array key "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..6ac9d9f779 100644
--- a/Zend/tests/globals_003.phpt
+++ b/Zend/tests/globals_003.phpt
@@ -7,21 +7,21 @@ variables_order="egpcs"
class test {
- static function bar() {
+ static function bar() {
- var_dump(isset($_SERVER));
- var_dump(empty($_SERVER));
- var_dump(gettype($_SERVER));
- var_dump(count($_SERVER));
+ var_dump(isset($_SERVER));
+ var_dump(empty($_SERVER));
+ var_dump(gettype($_SERVER));
+ var_dump(count($_SERVER));
- var_dump($_SERVER['PHP_SELF']);
- unset($_SERVER['PHP_SELF']);
- var_dump($_SERVER['PHP_SELF']);
+ var_dump($_SERVER['PHP_SELF']);
+ unset($_SERVER['PHP_SELF']);
+ var_dump($_SERVER['PHP_SELF']);
- unset($_SERVER);
- var_dump($_SERVER);
+ unset($_SERVER);
+ var_dump($_SERVER);
- }
+ }
}
test::bar();
@@ -35,9 +35,9 @@ string(5) "array"
int(%d)
string(%d) "%s"
-Notice: Undefined index: PHP_SELF in %s on line %d
+Warning: Undefined array key "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..27520a220c 100644
--- a/Zend/tests/globals_004.phpt
+++ b/Zend/tests/globals_004.phpt
@@ -6,7 +6,7 @@ variables_order="egpcs"
<?php
function test() {
- include __DIR__."/globals.inc";
+ include __DIR__."/globals.inc";
}
test();
@@ -20,9 +20,9 @@ string(5) "array"
int(%d)
string(%d) "%s"
-Notice: Undefined index: PHP_SELF in %s on line %d
+Warning: Undefined array key "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/grammar/regression_001.phpt b/Zend/tests/grammar/regression_001.phpt
index 657b36b853..144f094c61 100644
--- a/Zend/tests/grammar/regression_001.phpt
+++ b/Zend/tests/grammar/regression_001.phpt
@@ -4,7 +4,7 @@ Test to check static method calls syntax regression
<?php
class Foo {
- public static function function(){ echo __METHOD__, PHP_EOL; }
+ public static function function(){ echo __METHOD__, PHP_EOL; }
}
Foo::function();
@@ -13,15 +13,16 @@ Foo::
function();
Foo::
- function();
+ function();
Foo::
- function(
+ function(
);
echo "\nDone\n";
+?>
--EXPECT--
Foo::function
Foo::function
diff --git a/Zend/tests/grammar/regression_002.phpt b/Zend/tests/grammar/regression_002.phpt
index 52ca62d6ba..38c75abab9 100644
--- a/Zend/tests/grammar/regression_002.phpt
+++ b/Zend/tests/grammar/regression_002.phpt
@@ -14,6 +14,7 @@ var_dump(Foo:: CLASS);
var_dump(Foo::
CLASS);
+?>
--EXPECT--
string(3) "Foo"
string(3) "Foo"
diff --git a/Zend/tests/grammar/regression_004.phpt b/Zend/tests/grammar/regression_004.phpt
index f032fc882d..cd41cf01b3 100644
--- a/Zend/tests/grammar/regression_004.phpt
+++ b/Zend/tests/grammar/regression_004.phpt
@@ -10,5 +10,6 @@ class Obj
}
function echo(){} // not valid
+?>
--EXPECTF--
-Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting %s in %s on line 9
+Parse error: syntax error, unexpected token "echo", expecting "(" in %s on line %d
diff --git a/Zend/tests/grammar/regression_005.phpt b/Zend/tests/grammar/regression_005.phpt
index ad83ee717d..4cda26c322 100644
--- a/Zend/tests/grammar/regression_005.phpt
+++ b/Zend/tests/grammar/regression_005.phpt
@@ -9,5 +9,6 @@ class Obj
}
const return = 'nope';
+?>
--EXPECTF--
-Parse error: syntax error, unexpected 'return' (T_RETURN), expecting identifier (T_STRING) in %s on line 8
+Parse error: syntax error, unexpected token "return", expecting identifier in %s on line %d
diff --git a/Zend/tests/grammar/regression_006.phpt b/Zend/tests/grammar/regression_006.phpt
index 072148ca56..64d1cd3dcc 100644
--- a/Zend/tests/grammar/regression_006.phpt
+++ b/Zend/tests/grammar/regression_006.phpt
@@ -19,6 +19,7 @@ echo Obj::
USE, PHP_EOL;
echo "\nDone\n";
+?>
--EXPECT--
declare
return
diff --git a/Zend/tests/grammar/regression_007.phpt b/Zend/tests/grammar/regression_007.phpt
index b691ccaef9..15c9f1fddc 100644
--- a/Zend/tests/grammar/regression_007.phpt
+++ b/Zend/tests/grammar/regression_007.phpt
@@ -28,6 +28,7 @@ Foo::{'new'}();
var_dump(Foo::use);
echo "\nDone\n";
+?>
--EXPECT--
Foo::new
Foo::new
diff --git a/Zend/tests/grammar/regression_008.phpt b/Zend/tests/grammar/regression_008.phpt
index 57ae510722..15d5a3c0ed 100644
--- a/Zend/tests/grammar/regression_008.phpt
+++ b/Zend/tests/grammar/regression_008.phpt
@@ -12,6 +12,7 @@ $friday = new Friday;
echo "$friday->require ($friday->require) {$friday->require}", PHP_EOL;
echo "\nDone\n";
+?>
--EXPECT--
fun (fun) fun
diff --git a/Zend/tests/grammar/regression_009.phpt b/Zend/tests/grammar/regression_009.phpt
index 45fc81bcb8..c1fd1fb72c 100644
--- a/Zend/tests/grammar/regression_009.phpt
+++ b/Zend/tests/grammar/regression_009.phpt
@@ -12,5 +12,6 @@ class Foo
}
echo PHP_EOL, "Done", PHP_EOL;
+?>
--EXPECT--
Done
diff --git a/Zend/tests/grammar/regression_010.phpt b/Zend/tests/grammar/regression_010.phpt
index e5e65e3a85..0e535aad6b 100644
--- a/Zend/tests/grammar/regression_010.phpt
+++ b/Zend/tests/grammar/regression_010.phpt
@@ -5,8 +5,11 @@ Test to check regressions on T_IMPLEMENTS followed by a T_NS_SEPARATOR
interface A{}
+// No longer considered legal in PHP 8.
class B implements\A {}
echo "Done", PHP_EOL;
---EXPECT--
-Done
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected namespaced name "implements\A", expecting "{" in %s on line %d
diff --git a/Zend/tests/grammar/regression_012.phpt b/Zend/tests/grammar/regression_012.phpt
index 817f337a5c..4e3e175b41 100644
--- a/Zend/tests/grammar/regression_012.phpt
+++ b/Zend/tests/grammar/regression_012.phpt
@@ -9,4 +9,4 @@ class A {
?>
--EXPECTF--
-Parse error: syntax error, unexpected 'FOREACH' (T_FOREACH), expecting ']' in %s on line %d
+Parse error: syntax error, unexpected token "foreach", expecting "]" in %s on line %d
diff --git a/Zend/tests/grammar/semi_reserved_001.phpt b/Zend/tests/grammar/semi_reserved_001.phpt
index bbb8ccdede..2de8e901ef 100644
--- a/Zend/tests/grammar/semi_reserved_001.phpt
+++ b/Zend/tests/grammar/semi_reserved_001.phpt
@@ -163,6 +163,7 @@ $obj->__DIR__();
$obj->__NAMESPACE__();
echo "\nDone\n";
+?>
--EXPECT--
Obj::empty
Obj::callable
diff --git a/Zend/tests/grammar/semi_reserved_002.phpt b/Zend/tests/grammar/semi_reserved_002.phpt
index 59cd97479e..db780f9706 100644
--- a/Zend/tests/grammar/semi_reserved_002.phpt
+++ b/Zend/tests/grammar/semi_reserved_002.phpt
@@ -161,6 +161,7 @@ Obj::__DIR__();
Obj::__NAMESPACE__();
echo "\nDone\n";
+?>
--EXPECT--
Obj::empty
Obj::callable
diff --git a/Zend/tests/grammar/semi_reserved_004.phpt b/Zend/tests/grammar/semi_reserved_004.phpt
index 2ab1f3139e..63a13d145b 100644
--- a/Zend/tests/grammar/semi_reserved_004.phpt
+++ b/Zend/tests/grammar/semi_reserved_004.phpt
@@ -163,6 +163,7 @@ echo Obj::$__NAMESPACE__, PHP_EOL;
echo Obj::$__halt_compiler, PHP_EOL;
echo "\nDone\n";
+?>
--EXPECT--
empty
callable
diff --git a/Zend/tests/grammar/semi_reserved_005.phpt b/Zend/tests/grammar/semi_reserved_005.phpt
index 3e74024ecc..4a9a19e118 100644
--- a/Zend/tests/grammar/semi_reserved_005.phpt
+++ b/Zend/tests/grammar/semi_reserved_005.phpt
@@ -159,6 +159,7 @@ echo Obj::__DIR__, PHP_EOL;
echo Obj::__NAMESPACE__, PHP_EOL;
echo "\nDone\n";
+?>
--EXPECT--
empty
callable
diff --git a/Zend/tests/grammar/semi_reserved_006.phpt b/Zend/tests/grammar/semi_reserved_006.phpt
index 634ba51285..02afae0bb0 100644
--- a/Zend/tests/grammar/semi_reserved_006.phpt
+++ b/Zend/tests/grammar/semi_reserved_006.phpt
@@ -58,6 +58,7 @@ Foo::byebye();
Foo::farewell();
echo "\nDone\n";
+?>
--EXPECT--
TraitA::catch
TraitA::list
diff --git a/Zend/tests/grammar/semi_reserved_007.phpt b/Zend/tests/grammar/semi_reserved_007.phpt
index 64e55a8e2a..5c90199b3a 100644
--- a/Zend/tests/grammar/semi_reserved_007.phpt
+++ b/Zend/tests/grammar/semi_reserved_007.phpt
@@ -25,6 +25,7 @@ class Bar extends Foo {
new Bar;
echo "\nDone\n";
+?>
--EXPECT--
From Foo::__construct:
self
diff --git a/Zend/tests/grammar/semi_reserved_008.phpt b/Zend/tests/grammar/semi_reserved_008.phpt
index fe478323f8..83828170ca 100644
--- a/Zend/tests/grammar/semi_reserved_008.phpt
+++ b/Zend/tests/grammar/semi_reserved_008.phpt
@@ -61,6 +61,7 @@ Foo /**/
attempt();
echo PHP_EOL, "Done", PHP_EOL;
+?>
--EXPECT--
TraitB::try
diff --git a/Zend/tests/grammar/semi_reserved_009.phpt b/Zend/tests/grammar/semi_reserved_009.phpt
index 98ff4ee8f0..6f0622bc30 100644
--- a/Zend/tests/grammar/semi_reserved_009.phpt
+++ b/Zend/tests/grammar/semi_reserved_009.phpt
@@ -18,6 +18,7 @@ class Foo
Foo::try();
echo PHP_EOL, "Done", PHP_EOL;
+?>
--EXPECT--
TraitA::as
diff --git a/Zend/tests/grammar/semi_reserved_010.phpt b/Zend/tests/grammar/semi_reserved_010.phpt
index 951db73b85..38c0d55f70 100644
--- a/Zend/tests/grammar/semi_reserved_010.phpt
+++ b/Zend/tests/grammar/semi_reserved_010.phpt
@@ -24,6 +24,7 @@ class Foo
Foo::insteadof();
echo PHP_EOL, "Done", PHP_EOL;
+?>
--EXPECT--
TraitB::insteadof
diff --git a/Zend/tests/grandparent_prototype.phpt b/Zend/tests/grandparent_prototype.phpt
index 872969654d..39d66f46f0 100644
--- a/Zend/tests/grandparent_prototype.phpt
+++ b/Zend/tests/grandparent_prototype.phpt
@@ -8,7 +8,7 @@ class A {
}
class B extends A {
public function test2($x) {
- $x->test(); // Uncaught Error: Call to protected method D::test() from context 'B'
+ $x->test(); // Uncaught Error: Call to protected method D::test() from scope B
}
}
class C extends A {
diff --git a/Zend/tests/halt01.phpt b/Zend/tests/halt01.phpt
index 3af80d07a8..375170ce45 100644
--- a/Zend/tests/halt01.phpt
+++ b/Zend/tests/halt01.phpt
@@ -8,5 +8,6 @@ print "yo!\n";
__HALT_COMPILER();
none of this should be displayed!
+?>
--EXPECT--
yo!
diff --git a/Zend/tests/halt03.phpt b/Zend/tests/halt03.phpt
index 6e0931b02f..bbc28dc78e 100644
--- a/Zend/tests/halt03.phpt
+++ b/Zend/tests/halt03.phpt
@@ -4,7 +4,8 @@ __HALT_COMPILER() basic test
<?php
if (true) {
- __HALT_COMPILER();
+ __HALT_COMPILER();
}
+?>
--EXPECTF--
Fatal error: __HALT_COMPILER() can only be used from the outermost scope in %shalt03.php on line %d
diff --git a/Zend/tests/halt_compiler2.phpt b/Zend/tests/halt_compiler2.phpt
index a89274a804..09af8b2a03 100644
--- a/Zend/tests/halt_compiler2.phpt
+++ b/Zend/tests/halt_compiler2.phpt
@@ -11,7 +11,6 @@ file_put_contents(__DIR__ . '/test2.php', $text);
include __DIR__ . '/test1.php';
include __DIR__ . '/test2.php';
?>
-==DONE==
--CLEAN--
<?php
unlink(__DIR__ . '/test1.php');
@@ -20,4 +19,3 @@ unlink(__DIR__ . '/test2.php');
--EXPECT--
testint(73)
test2int(74)
-==DONE==
diff --git a/Zend/tests/halt_compiler3.phpt b/Zend/tests/halt_compiler3.phpt
index 7bd7410c73..ff25b13333 100644
--- a/Zend/tests/halt_compiler3.phpt
+++ b/Zend/tests/halt_compiler3.phpt
@@ -4,7 +4,5 @@ __HALT_COMPILER(); bad define() of __COMPILER_HALT_OFFSET__ 1
<?php
define ('__COMPILER_HALT_OFFSET__', 1);
?>
-==DONE==
--EXPECTF--
-Notice: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d
-==DONE==
+Warning: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d
diff --git a/Zend/tests/halt_compiler4.phpt b/Zend/tests/halt_compiler4.phpt
index 53a4fc76f9..bb96f25ed9 100644
--- a/Zend/tests/halt_compiler4.phpt
+++ b/Zend/tests/halt_compiler4.phpt
@@ -7,4 +7,4 @@ __HALT_COMPILER();
?>
==DONE==
--EXPECTF--
-Notice: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d
+Warning: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d
diff --git a/Zend/tests/halt_compiler5.phpt b/Zend/tests/halt_compiler5.phpt
index 71d973e4f7..7b21c4b06c 100644
--- a/Zend/tests/halt_compiler5.phpt
+++ b/Zend/tests/halt_compiler5.phpt
@@ -4,5 +4,9 @@ Using __COMPILER_HALF_OFFSET__ with trailing {} (OSS-Fuzz #17895)
<?php
__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/hex_overflow_32bit.phpt b/Zend/tests/hex_overflow_32bit.phpt
index 529757dd56..71be6dc051 100644
--- a/Zend/tests/hex_overflow_32bit.phpt
+++ b/Zend/tests/hex_overflow_32bit.phpt
@@ -1,22 +1,22 @@
--TEST--
testing integer overflow (32bit)
--INI--
-precision=14
+serialize_precision=14
--SKIPIF--
<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
--FILE--
<?php
$doubles = array(
- 0x1736123FFFAAA,
- 0XFFFFFFFFFFFFFFFFFF,
- 0xAAAAAAAAAAAAAAEEEEEEEEEBBB,
- 0x66666666666666666777777,
- );
+ 0x1736123FFFAAA,
+ 0XFFFFFFFFFFFFFFFFFF,
+ 0xAAAAAAAAAAAAAAEEEEEEEEEBBB,
+ 0x66666666666666666777777,
+ );
foreach ($doubles as $d) {
- $l = $d;
- var_dump($l);
+ $l = $d;
+ var_dump($l);
}
echo "Done\n";
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/include_stat_is_quiet.phpt b/Zend/tests/include_stat_is_quiet.phpt
index 006fad50bd..ef8240f9ca 100644
--- a/Zend/tests/include_stat_is_quiet.phpt
+++ b/Zend/tests/include_stat_is_quiet.phpt
@@ -25,6 +25,9 @@ try {
?>
--EXPECTF--
-Warning: require_once(doesnt_exist.php): failed to open stream: No such file or directory in %s on line %d
+Warning: require_once(doesnt_exist.php): Failed to open stream: No such file or directory in %s on line %d
-Fatal error: require_once(): Failed opening required 'doesnt_exist.php' (include_path='test://foo:test://bar') in %s on line %d
+Fatal error: Uncaught Error: Failed opening required 'doesnt_exist.php' (include_path='test://foo:test://bar') in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt
index 25c95ba219..3fe0456175 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
+--EXPECT--
+Exception: Non-static method A::foo() cannot be called statically
diff --git a/Zend/tests/increment_001.phpt b/Zend/tests/increment_001.phpt
index 16323381b8..f343771926 100644
--- a/Zend/tests/increment_001.phpt
+++ b/Zend/tests/increment_001.phpt
@@ -8,31 +8,36 @@ precision=14
<?php
$a = array(
- array(1,2,3),
- "",
- 1,
- 2.5,
- 0,
- "string",
- "123",
- "2.5",
- NULL,
- true,
- false,
- new stdclass,
- array(),
- PHP_INT_MAX,
- (string)PHP_INT_MAX
+ array(1,2,3),
+ "",
+ 1,
+ 2.5,
+ 0,
+ "string",
+ "123",
+ "2.5",
+ NULL,
+ true,
+ false,
+ new stdclass,
+ array(),
+ PHP_INT_MAX,
+ (string)PHP_INT_MAX
);
foreach ($a as $var) {
- $var++;
- var_dump($var);
+ try {
+ $var++;
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ var_dump($var);
}
echo "Done\n";
?>
--EXPECTF--
+Cannot increment array
array(3) {
[0]=>
int(1)
@@ -51,8 +56,10 @@ float(3.5)
int(1)
bool(true)
bool(false)
+Cannot increment stdClass
object(stdClass)#%d (0) {
}
+Cannot increment array
array(0) {
}
float(2147483648)
diff --git a/Zend/tests/indexing_001.phpt b/Zend/tests/indexing_001.phpt
index f247a420b5..c712b09802 100644
--- a/Zend/tests/indexing_001.phpt
+++ b/Zend/tests/indexing_001.phpt
@@ -7,36 +7,50 @@ $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);
}
-
-echo "\nDone";
?>
--EXPECTF--
*** Indexing - Testing value assignment with key ***
@@ -47,14 +61,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"]=>
@@ -64,17 +75,14 @@ array(1) {
}
}
-Warning: Illegal string offset 'foo' in %s on line %d
-
-Notice: Array to string conversion in %s on line %d
-string(1) "A"
+Warning: Array to string conversion in %s on line %d
+Cannot access offset of type string on string
+string(0) ""
-Warning: Illegal string offset 'foo' in %s on line %d
-
-Notice: 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
+Warning: Array to string conversion in %s on line %d
+Cannot access offset of type string on string
+string(1) " "
+Cannot use a scalar value as an array
float(0.1)
array(1) {
["foo"]=>
@@ -92,14 +100,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 +113,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 +130,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 +143,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 +161,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 +174,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]=>
@@ -187,5 +183,3 @@ array(1) {
int(1)
}
}
-
-Done
diff --git a/Zend/tests/indirect_call_array_001.phpt b/Zend/tests/indirect_call_array_001.phpt
index d76837c8eb..4f669781aa 100644
--- a/Zend/tests/indirect_call_array_001.phpt
+++ b/Zend/tests/indirect_call_array_001.phpt
@@ -8,7 +8,7 @@ $arr();
?>
--EXPECTF--
-Fatal error: Uncaught Error: Class 'a' not found in %s:%d
+Fatal error: Uncaught Error: Class "a" not found in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/indirect_call_array_003.phpt b/Zend/tests/indirect_call_array_003.phpt
index b4b713ff64..603b3bfc29 100644
--- a/Zend/tests/indirect_call_array_003.phpt
+++ b/Zend/tests/indirect_call_array_003.phpt
@@ -4,23 +4,23 @@ Indirect method call by array - Calling __call() and __callStatic()
<?php
class foo {
- public function __call($a, $b) {
- printf("From %s:\n", __METHOD__);
- var_dump($a);
- var_dump($this);
- }
- static public function __callStatic($a, $b) {
- printf("From %s:\n", __METHOD__);
- var_dump($a);
- var_dump($this);
- }
+ public function __call($a, $b) {
+ printf("From %s:\n", __METHOD__);
+ var_dump($a);
+ var_dump($this);
+ }
+ static public function __callStatic($a, $b) {
+ printf("From %s:\n", __METHOD__);
+ var_dump($a);
+ var_dump($this);
+ }
}
$arr = array('foo', 'abc');
try {
- $arr();
+ $arr();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
$foo = new foo;
$arr = array($foo, 'abc');
diff --git a/Zend/tests/indirect_call_array_004.phpt b/Zend/tests/indirect_call_array_004.phpt
index 07d8a09215..e8520efd12 100644
--- a/Zend/tests/indirect_call_array_004.phpt
+++ b/Zend/tests/indirect_call_array_004.phpt
@@ -4,36 +4,36 @@ Indirect method call by array - Testing exception and method magics
<?php
class foo {
- static public function abc() {
- throw new Exception('foo');
- }
- public function __call($a, $b) {
- printf("From %s:\n", __METHOD__);
- throw new Exception($a);
- }
- static public function __callStatic($a, $b) {
- printf("From %s:\n", __METHOD__);
- throw new Exception($a);
- }
+ static public function abc() {
+ throw new Exception('foo');
+ }
+ public function __call($a, $b) {
+ printf("From %s:\n", __METHOD__);
+ throw new Exception($a);
+ }
+ static public function __callStatic($a, $b) {
+ printf("From %s:\n", __METHOD__);
+ throw new Exception($a);
+ }
}
$arr = array('foo', 'abc');
try {
- $arr();
+ $arr();
}
catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
$arr = array('foo', '123');
try {
- $arr();
+ $arr();
}
catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
@@ -43,10 +43,10 @@ $foo = new foo;
$arr = array($foo, 'abc');
try {
- $arr();
+ $arr();
}
catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
@@ -54,10 +54,10 @@ $foo = new foo;
$arr = array($foo, '123');
try {
- $arr();
+ $arr();
}
catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
?>
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_002.phpt b/Zend/tests/indirect_call_string_002.phpt
index ecb0b6d80f..7704c1cd9a 100644
--- a/Zend/tests/indirect_call_string_002.phpt
+++ b/Zend/tests/indirect_call_string_002.phpt
@@ -77,10 +77,10 @@ try {
--EXPECT--
string(0) ""
string(0) ""
-Class '' not found
-Class '' not found
-Class '' not found
-Class '' not found
+Class "" not found
+Class "" not found
+Class "" not found
+Class "" not found
Call to undefined function Class:()
Call to undefined function :method()
Call to undefined function :()
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/indirect_method_call_001.phpt b/Zend/tests/indirect_method_call_001.phpt
index 7018eaa740..39967fdb26 100644
--- a/Zend/tests/indirect_method_call_001.phpt
+++ b/Zend/tests/indirect_method_call_001.phpt
@@ -4,15 +4,15 @@ Testing indirect method call and exceptions
<?php
class foo {
- public function __construct() {
- throw new Exception('foobar');
- }
+ public function __construct() {
+ throw new Exception('foobar');
+ }
}
try {
- $X = (new foo)->Inexistent(3);
+ $X = (new foo)->Inexistent(3);
} catch (Exception $e) {
- var_dump($e->getMessage()); // foobar
+ var_dump($e->getMessage()); // foobar
}
?>
diff --git a/Zend/tests/indirect_method_call_002.phpt b/Zend/tests/indirect_method_call_002.phpt
index 059061f211..e8ea14b165 100644
--- a/Zend/tests/indirect_method_call_002.phpt
+++ b/Zend/tests/indirect_method_call_002.phpt
@@ -4,16 +4,16 @@ Indirect method call with chaining
<?php
class foo {
- public $x = 'testing';
+ public $x = 'testing';
- public function bar() {
- return "foo";
- }
- public function baz() {
- return new self;
- }
- static function xyz() {
- }
+ public function bar() {
+ return "foo";
+ }
+ public function baz() {
+ return new self;
+ }
+ static function xyz() {
+ }
}
var_dump((new foo())->bar()); // string(3) "foo"
diff --git a/Zend/tests/indirect_method_call_003.phpt b/Zend/tests/indirect_method_call_003.phpt
index 3df495422d..2ae694d821 100644
--- a/Zend/tests/indirect_method_call_003.phpt
+++ b/Zend/tests/indirect_method_call_003.phpt
@@ -4,15 +4,15 @@ Testing indirect method call
<?php
class foo {
- public $x = 1;
+ public $x = 1;
- public function getX() {
- return $this->x;
- }
- public function setX($val) {
- $this->x = $val;
- return $this;
- }
+ public function getX() {
+ return $this->x;
+ }
+ public function setX($val) {
+ $this->x = $val;
+ return $this;
+ }
}
$X = (new foo)->setX(10)->getX();
diff --git a/Zend/tests/indirect_method_call_004.phpt b/Zend/tests/indirect_method_call_004.phpt
index 689600d1f4..6a4055595c 100644
--- a/Zend/tests/indirect_method_call_004.phpt
+++ b/Zend/tests/indirect_method_call_004.phpt
@@ -5,14 +5,14 @@ Indirect method call and cloning
class bar {
- public $z;
+ public $z;
- public function __construct() {
- $this->z = new stdclass;
- }
- public function getZ() {
- return $this->z;
- }
+ public function __construct() {
+ $this->z = new stdclass;
+ }
+ public function getZ() {
+ return $this->z;
+ }
}
var_dump(clone (new bar)->z);
diff --git a/Zend/tests/indirect_method_call_005.phpt b/Zend/tests/indirect_method_call_005.phpt
index 4f4b3631c0..d3e2de2c84 100644
--- a/Zend/tests/indirect_method_call_005.phpt
+++ b/Zend/tests/indirect_method_call_005.phpt
@@ -4,9 +4,9 @@ Testing array dereferencing from instance with ArrayObject
<?php
class foo extends ArrayObject {
- public function __construct($arr) {
- parent::__construct($arr);
- }
+ public function __construct($arr) {
+ parent::__construct($arr);
+ }
}
var_dump( (new foo( array(1, array(4, 5), 3) ))[1][0] ); // int(4)
diff --git a/Zend/tests/indirect_property_access.phpt b/Zend/tests/indirect_property_access.phpt
index 3645687f41..eff8521e12 100644
--- a/Zend/tests/indirect_property_access.phpt
+++ b/Zend/tests/indirect_property_access.phpt
@@ -4,11 +4,11 @@ Testing indirect property access
<?php
class foo {
- public $x = 1;
+ public $x = 1;
}
class bar {
- public $y = 'foo';
+ public $y = 'foo';
}
$x = 'bar';
diff --git a/Zend/tests/inference_infinite_loop.phpt b/Zend/tests/inference_infinite_loop.phpt
index 1e94ea8040..a0f56e2d2b 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..cfa1176c50 100644
--- a/Zend/tests/instanceof.phpt
+++ b/Zend/tests/instanceof.phpt
@@ -1,10 +1,10 @@
--TEST--
-instanceof shouldn't call __autoload
+instanceof shouldn't call autoloader
--FILE--
<?php
spl_autoload_register(function ($name) {
- echo("AUTOLOAD '$name'\n");
- eval("class $name {}");
+ echo("AUTOLOAD '$name'\n");
+ eval("class $name {}");
});
class A {
diff --git a/Zend/tests/instanceof_001.phpt b/Zend/tests/instanceof_001.phpt
index 6bdcb896af..02b7d59baf 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);
@@ -17,11 +17,9 @@ var_dump($c[0] instanceof stdClass);
var_dump(@$inexistent instanceof stdClass);
?>
---EXPECTF--
+--EXPECT--
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/instantiate_all_classes.phpt b/Zend/tests/instantiate_all_classes.phpt
new file mode 100644
index 0000000000..b8d82530f3
--- /dev/null
+++ b/Zend/tests/instantiate_all_classes.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Try to instantiate all classes without arguments
+--FILE--
+<?php
+
+foreach (get_declared_classes() as $class) {
+ try {
+ new $class;
+ } catch (Throwable) {}
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/int_conversion_exponents.phpt b/Zend/tests/int_conversion_exponents.phpt
index d924cb7b81..1e4ce72cee 100644
--- a/Zend/tests/int_conversion_exponents.phpt
+++ b/Zend/tests/int_conversion_exponents.phpt
@@ -39,14 +39,14 @@ int(-1234500000)
int(1234500000)
int(-1234500000)
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(1234500000)
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(-1234500000)
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(1234500000)
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: A non-numeric value encountered in %s on line %d
int(-1234500000)
diff --git a/Zend/tests/int_overflow_32bit.phpt b/Zend/tests/int_overflow_32bit.phpt
index cfbf059630..15dce6eea7 100644
--- a/Zend/tests/int_overflow_32bit.phpt
+++ b/Zend/tests/int_overflow_32bit.phpt
@@ -6,16 +6,16 @@ testing integer overflow (32bit)
<?php
$doubles = array(
- 2147483648,
- 2147483649,
- 2147483658,
- 2147483748,
- 2147484648,
- );
+ 2147483648,
+ 2147483649,
+ 2147483658,
+ 2147483748,
+ 2147484648,
+ );
foreach ($doubles as $d) {
- $l = (int)$d;
- var_dump($l);
+ $l = (int)$d;
+ var_dump($l);
}
echo "Done\n";
diff --git a/Zend/tests/int_static_prop_name.phpt b/Zend/tests/int_static_prop_name.phpt
index cb47bb6d0a..e29e2514bb 100644
--- a/Zend/tests/int_static_prop_name.phpt
+++ b/Zend/tests/int_static_prop_name.phpt
@@ -37,6 +37,6 @@ try {
int(24)
int(24)
int(24)
-Access to undeclared static property: Foo::$42
-Access to undeclared static property: Foo::$42
-Access to undeclared static property: Foo::$42
+Access to undeclared static property Foo::$42
+Access to undeclared static property Foo::$42
+Access to undeclared static property Foo::$42
diff --git a/Zend/tests/int_underflow_32bit.phpt b/Zend/tests/int_underflow_32bit.phpt
index 79a949aac5..71464a758a 100644
--- a/Zend/tests/int_underflow_32bit.phpt
+++ b/Zend/tests/int_underflow_32bit.phpt
@@ -6,16 +6,16 @@ testing integer underflow (32bit)
<?php
$doubles = array(
- -2147483648,
- -2147483649,
- -2147483658,
- -2147483748,
- -2147484648,
- );
+ -2147483648,
+ -2147483649,
+ -2147483658,
+ -2147483748,
+ -2147484648,
+ );
foreach ($doubles as $d) {
- $l = (int)$d;
- var_dump($l);
+ $l = (int)$d;
+ var_dump($l);
}
echo "Done\n";
diff --git a/Zend/tests/inter_007.phpt b/Zend/tests/inter_007.phpt
index fa7c368a5e..beda6c00d0 100644
--- a/Zend/tests/inter_007.phpt
+++ b/Zend/tests/inter_007.phpt
@@ -4,11 +4,11 @@ Trying inherit abstract function twice
<?php
interface d {
- static function B();
+ static function B();
}
interface c {
- function b();
+ function b();
}
class_alias('c', 'w');
diff --git a/Zend/tests/inter_03.phpt b/Zend/tests/inter_03.phpt
index 48c1b5eec2..d57d3a5469 100644
--- a/Zend/tests/inter_03.phpt
+++ b/Zend/tests/inter_03.phpt
@@ -4,11 +4,11 @@ Testing interface constants with inheritance
<?php
interface a {
- const b = 2;
+ const b = 2;
}
interface b extends a {
- const c = self::b;
+ const c = self::b;
}
var_dump(b::c, a::b);
diff --git a/Zend/tests/inter_04.phpt b/Zend/tests/inter_04.phpt
index 97fddf73b2..b697f68b5d 100644
--- a/Zend/tests/inter_04.phpt
+++ b/Zend/tests/inter_04.phpt
@@ -4,11 +4,11 @@ Trying declare interface with repeated name of inherited method
<?php
interface a {
- function b();
+ function b();
}
interface b {
- function b();
+ function b();
}
interface c extends a, b {
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/interface_extends_static.phpt b/Zend/tests/interface_extends_static.phpt
new file mode 100644
index 0000000000..3d12070ec8
--- /dev/null
+++ b/Zend/tests/interface_extends_static.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Interface cannot extend static, as it is reserved
+--FILE--
+<?php
+
+interface Foo extends static {}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use 'static' as interface name, as it is reserved in %s on line %d
diff --git a/Zend/tests/invalid_parent_const_ref_leak.phpt b/Zend/tests/invalid_parent_const_ref_leak.phpt
index 33e2548f31..ed728f7d45 100644
--- a/Zend/tests/invalid_parent_const_ref_leak.phpt
+++ b/Zend/tests/invalid_parent_const_ref_leak.phpt
@@ -15,4 +15,4 @@ try {
?>
--EXPECT--
-Cannot access parent:: when current class scope has no parent
+Cannot access "parent" when current class scope has no parent
diff --git a/Zend/tests/is_a.phpt b/Zend/tests/is_a.phpt
index 3714d50a62..aa272d4e67 100644
--- a/Zend/tests/is_a.phpt
+++ b/Zend/tests/is_a.phpt
@@ -1,12 +1,12 @@
--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--
<?php
spl_autoload_register(function ($name) {
- echo("AUTOLOAD '$name'\n");
- eval("class $name {}");
+ echo("AUTOLOAD '$name'\n");
+ eval("class $name {}");
});
class BASE {
diff --git a/Zend/tests/isset_001.phpt b/Zend/tests/isset_001.phpt
index 340b23701e..1a0fc35de9 100644
--- a/Zend/tests/isset_001.phpt
+++ b/Zend/tests/isset_001.phpt
@@ -8,13 +8,13 @@ print "- isset ---\n";
$var_name = 'unexisting';
if (isset($$var_name)) {
- print "error\n";
+ print "error\n";
}
$test = 'var_name';
if (isset($$$test)) {
- print "error\n";
+ print "error\n";
}
print "- unset ---\n";
diff --git a/Zend/tests/isset_003.phpt b/Zend/tests/isset_003.phpt
index 06cbe3d51d..6979a847af 100644
--- a/Zend/tests/isset_003.phpt
+++ b/Zend/tests/isset_003.phpt
@@ -1,5 +1,5 @@
--TEST--
-Testing isset accessing undefined array itens and properties
+Testing isset accessing undefined array items and properties
--FILE--
<?php
@@ -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: Attempt to read property "" on string in %s on line %d
bool(false)
bool(true)
bool(false)
diff --git a/Zend/tests/isset_array.phpt b/Zend/tests/isset_array.phpt
new file mode 100644
index 0000000000..c7c1876410
--- /dev/null
+++ b/Zend/tests/isset_array.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Using isset() with arrays
+--FILE--
+<?php
+
+$array = [
+ 0 => true,
+ "a" => true,
+];
+
+var_dump(isset($array[0]));
+
+var_dump(isset($array["a"]));
+
+var_dump(isset($array[false]));
+
+var_dump(isset($array[0.6]));
+
+var_dump(isset($array[true]));
+
+var_dump(isset($array[null]));
+
+var_dump(isset($array[STDIN]));
+
+try {
+ isset($array[[]]);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ isset($array[new stdClass()]);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+bool(false)
+Illegal offset type in isset or empty
+Illegal offset type in isset or empty
diff --git a/Zend/tests/iterable_or_null.phpt b/Zend/tests/iterable_or_null.phpt
new file mode 100644
index 0000000000..9f798af06d
--- /dev/null
+++ b/Zend/tests/iterable_or_null.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test Z_PARAM_ITERABLE() and Z_PARAM_ITERABLE_OR_NULL
+--SKIPIF--
+<?php
+if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
+?>
+--FILE--
+<?php
+
+try {
+ var_dump(zend_iterable("string"));
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ var_dump(zend_iterable(1));
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ var_dump(zend_iterable(null));
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+
+zend_iterable([]);
+zend_iterable([], []);
+
+$iterator = new ArrayIterator([]);
+zend_iterable($iterator);
+zend_iterable($iterator, $iterator);
+zend_iterable($iterator, null);
+
+try {
+ var_dump(zend_iterable([], "string"));
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+zend_iterable(): Argument #1 ($arg1) must be of type iterable, string given
+zend_iterable(): Argument #1 ($arg1) must be of type iterable, int given
+zend_iterable(): Argument #1 ($arg1) must be of type iterable, null given
+zend_iterable(): Argument #2 ($arg2) must be of type ?iterable, string given
+
diff --git a/Zend/tests/jump03.phpt b/Zend/tests/jump03.phpt
index 2399f30ade..c43bb15464 100644
--- a/Zend/tests/jump03.phpt
+++ b/Zend/tests/jump03.phpt
@@ -3,14 +3,14 @@ jump 03: goto inside control structures
--FILE--
<?php
do {
- if (1) {
- echo "1: ok\n";
- goto L1;
- } else {
- echo "bug\n";
+ if (1) {
+ echo "1: ok\n";
+ goto L1;
+ } else {
+ echo "bug\n";
L1:
- echo "2: ok\n";
- }
+ echo "2: ok\n";
+ }
} while (0);
?>
--EXPECT--
diff --git a/Zend/tests/jump04.phpt b/Zend/tests/jump04.phpt
index 29ec25d8bd..ed6ccf6e67 100644
--- a/Zend/tests/jump04.phpt
+++ b/Zend/tests/jump04.phpt
@@ -5,16 +5,16 @@ jump 04: goto from loop (backward)
$s = "X";
echo "1: ok\n";
L1: if ($s != "X") {
- echo "4: ok\n";
+ echo "4: ok\n";
} else {
- echo "2: ok\n";
- while ($s != "XXX") {
- echo "3: ok\n";
- $s .= "X";
- goto L1;
- echo "bug\n";
- }
- echo "bug\n";
+ echo "2: ok\n";
+ while ($s != "XXX") {
+ echo "3: ok\n";
+ $s .= "X";
+ goto L1;
+ echo "bug\n";
+ }
+ echo "bug\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/jump05.phpt b/Zend/tests/jump05.phpt
index 2e5e50c068..1dec75e4a7 100644
--- a/Zend/tests/jump05.phpt
+++ b/Zend/tests/jump05.phpt
@@ -4,17 +4,17 @@ jump 05: goto from loop (forward)
<?php
$ar = array("1","2","3");
foreach ($ar as $val) {
- switch ($val) {
- case "1":
- echo "1: ok\n";
- break;
- case "2":
- echo "2: ok\n";
- goto L1;
- case "3":
- echo "bug\n";
- break;
- }
+ switch ($val) {
+ case "1":
+ echo "1: ok\n";
+ break;
+ case "2":
+ echo "2: ok\n";
+ goto L1;
+ case "3":
+ echo "bug\n";
+ break;
+ }
}
echo "bug\n";
L1:
diff --git a/Zend/tests/jump07.phpt b/Zend/tests/jump07.phpt
index c0cb112a7b..6015b91a53 100644
--- a/Zend/tests/jump07.phpt
+++ b/Zend/tests/jump07.phpt
@@ -3,7 +3,7 @@ jump 07: goto into loop (backward)
--FILE--
<?php
while (0) {
- L1: echo "bug\n";
+ L1: echo "bug\n";
}
goto L1;
?>
diff --git a/Zend/tests/jump08.phpt b/Zend/tests/jump08.phpt
index 25a211c8c4..e2f7cd4bc6 100644
--- a/Zend/tests/jump08.phpt
+++ b/Zend/tests/jump08.phpt
@@ -4,7 +4,7 @@ jump 08: goto into loop (forward)
<?php
goto L1;
while (0) {
- L1: echo "bug\n";
+ L1: echo "bug\n";
}
?>
--EXPECTF--
diff --git a/Zend/tests/jump09.phpt b/Zend/tests/jump09.phpt
index 52a14b7d54..1d3420fddb 100644
--- a/Zend/tests/jump09.phpt
+++ b/Zend/tests/jump09.phpt
@@ -3,9 +3,9 @@ jump 09: goto into switch (backward)
--FILE--
<?php
switch (0) {
- case 1:
- L1: echo "bug\n";
- break;
+ case 1:
+ L1: echo "bug\n";
+ break;
}
goto L1;
?>
diff --git a/Zend/tests/jump10.phpt b/Zend/tests/jump10.phpt
index 67206a29ae..e69c508d6a 100644
--- a/Zend/tests/jump10.phpt
+++ b/Zend/tests/jump10.phpt
@@ -4,9 +4,9 @@ jump 10: goto into switch (forward)
<?php
goto L1;
switch (0) {
- case 1:
- L1: echo "bug\n";
- break;
+ case 1:
+ L1: echo "bug\n";
+ break;
}
?>
--EXPECTF--
diff --git a/Zend/tests/jump14.phpt b/Zend/tests/jump14.phpt
index f55480acc7..4df251f766 100644
--- a/Zend/tests/jump14.phpt
+++ b/Zend/tests/jump14.phpt
@@ -6,21 +6,21 @@ Testing GOTO inside blocks
goto A;
{
- B:
- goto C;
- return;
+ B:
+ goto C;
+ return;
}
A:
- goto B;
+ goto B;
{
- C:
- {
- print "Done!\n";
- }
+ C:
+ {
+ print "Done!\n";
+ }
}
?>
diff --git a/Zend/tests/jump15.phpt b/Zend/tests/jump15.phpt
index 456d27785d..4f599a3bb0 100644
--- a/Zend/tests/jump15.phpt
+++ b/Zend/tests/jump15.phpt
@@ -4,22 +4,22 @@ jump 15: goto from loop (forward)
<?php
$ar = array("1","2","3");
foreach ($ar as $val) {
- switch ($val) {
- case "1":
- echo "1: ok\n";
- break;
- case "2":
- echo "2: ok\n";
- goto L1;
- case "3":
- echo "bug\n";
- break;
- }
+ switch ($val) {
+ case "1":
+ echo "1: ok\n";
+ break;
+ case "2":
+ echo "2: ok\n";
+ goto L1;
+ case "3":
+ echo "bug\n";
+ break;
+ }
}
echo "bug\n";
L1:
try {
- echo "3: ok\n";
+ echo "3: ok\n";
} finally {
}
?>
diff --git a/Zend/tests/jump16.phpt b/Zend/tests/jump16.phpt
index cc820c4a6c..0a4acd1422 100644
--- a/Zend/tests/jump16.phpt
+++ b/Zend/tests/jump16.phpt
@@ -4,22 +4,22 @@ jump 16: goto into try/catch
<?php
goto a;
try {
- echo "1";
+ echo "1";
a:
- echo "2";
- throw new Exception();
+ echo "2";
+ throw new Exception();
} catch (Exception $e) {
- echo "3";
+ echo "3";
}
echo "4";
goto b;
try {
- echo "5";
- throw new Exception();
+ echo "5";
+ throw new Exception();
} catch (Exception $e) {
- echo "6";
+ echo "6";
b:
- echo "7";
+ echo "7";
}
echo "8\n";
?>
diff --git a/Zend/tests/jump17.phpt b/Zend/tests/jump17.phpt
index 92d3be511b..64f7721fef 100644
--- a/Zend/tests/jump17.phpt
+++ b/Zend/tests/jump17.phpt
@@ -4,19 +4,20 @@ jump 17: goto into try/catch with finally
<?php
goto b;
try {
- echo "1";
+ echo "1";
a:
- echo "2";
- throw new Exception();
+ echo "2";
+ throw new Exception();
} catch (Exception $e) {
- echo "3";
+ echo "3";
b:
- echo "4";
+ echo "4";
} finally {
- echo "5";
+ echo "5";
c:
- echo "6";
+ echo "6";
}
echo "7\n";
+?>
--EXPECT--
4567
diff --git a/Zend/tests/lc_ctype_inheritance.phpt b/Zend/tests/lc_ctype_inheritance.phpt
new file mode 100644
index 0000000000..8971ff1969
--- /dev/null
+++ b/Zend/tests/lc_ctype_inheritance.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Do not inherit LC_CTYPE from environment
+--SKIPIF--
+<?php
+if (!setlocale(LC_CTYPE, "de_DE", "de-DE")) die("skip requires de_DE locale");
+?>
+--ENV--
+LC_CTYPE=de_DE
+--FILE--
+<?php
+
+var_dump(setlocale(LC_CTYPE, "0"));
+var_dump(bin2hex(strtoupper("\xe4")));
+var_dump(preg_match('/\w/', "\xe4"));
+var_dump(setlocale(LC_CTYPE, "de_DE", "de-DE") !== false);
+var_dump(bin2hex(strtoupper("\xe4")));
+var_dump(preg_match('/\w/', "\xe4"));
+?>
+--EXPECT--
+string(1) "C"
+string(2) "e4"
+int(0)
+bool(true)
+string(2) "c4"
+int(1)
diff --git a/Zend/tests/list/list_reference_006.phpt b/Zend/tests/list/list_reference_006.phpt
index f85edf04a4..6dc6db4eb6 100644
--- a/Zend/tests/list/list_reference_006.phpt
+++ b/Zend/tests/list/list_reference_006.phpt
@@ -35,7 +35,7 @@ object(StorageNoRef)#1 (1) {
}
}
-Notice: Undefined offset: 2 in %s on line %d
+Warning: Undefined array key 2 in %s on line %d
object(StorageNoRef)#2 (1) {
["s":"StorageNoRef":private]=>
array(2) {
diff --git a/Zend/tests/list_006.phpt b/Zend/tests/list_006.phpt
index d380235d25..18ae13c400 100644
--- a/Zend/tests/list_006.phpt
+++ b/Zend/tests/list_006.phpt
@@ -7,6 +7,6 @@ list($a, list($b, list(list($d)))) = array();
?>
--EXPECTF--
-Notice: Undefined offset: 0 in %s on line %d
+Warning: Undefined array key 0 in %s on line %d
-Notice: Undefined offset: 1 in %s on line %d
+Warning: Undefined array key 1 in %s on line %d
diff --git a/Zend/tests/list_011.phpt b/Zend/tests/list_011.phpt
index 316498c411..a5cfe69f0c 100644
--- a/Zend/tests/list_011.phpt
+++ b/Zend/tests/list_011.phpt
@@ -7,4 +7,4 @@ var_dump(list(1, 2, 3));
?>
--EXPECTF--
-Parse error: syntax error, unexpected ')', expecting '=' in %s on line %d
+Parse error: syntax error, unexpected token ")", expecting "=" in %s on line %d
diff --git a/Zend/tests/list_keyed_conversions.phpt b/Zend/tests/list_keyed_conversions.phpt
index bf0349b327..6b213d60f4 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
+Warning: Undefined array key 1 in %s on line %d
diff --git a/Zend/tests/list_keyed_evaluation_order.inc b/Zend/tests/list_keyed_evaluation_order.inc
index d4ee778b63..577a19a838 100644
--- a/Zend/tests/list_keyed_evaluation_order.inc
+++ b/Zend/tests/list_keyed_evaluation_order.inc
@@ -2,7 +2,7 @@
// Observer objects for the Zend/tests/list_keyed_evaluation_order.* tests
-class Stringable
+class StringCapable
{
private $name;
public function __construct(string $name) {
diff --git a/Zend/tests/list_keyed_evaluation_order.phpt b/Zend/tests/list_keyed_evaluation_order.phpt
index 0f0652b6a9..3c5fb7e877 100644
--- a/Zend/tests/list_keyed_evaluation_order.phpt
+++ b/Zend/tests/list_keyed_evaluation_order.phpt
@@ -5,8 +5,8 @@ list() with keys, evaluation order
require_once "list_keyed_evaluation_order.inc";
-$a = new Stringable("A");
-$c = new Stringable("C");
+$a = new StringCapable("A");
+$c = new StringCapable("C");
$e = new IndexableRetrievable("E", new Indexable(["A" => "value for offset A", "C" => "value for offset C"]));
diff --git a/Zend/tests/list_keyed_evaluation_order_nested.phpt b/Zend/tests/list_keyed_evaluation_order_nested.phpt
index 8a7725d4ea..496deefbb9 100644
--- a/Zend/tests/list_keyed_evaluation_order_nested.phpt
+++ b/Zend/tests/list_keyed_evaluation_order_nested.phpt
@@ -5,11 +5,11 @@ list() with keys, evaluation order: nested
require_once "list_keyed_evaluation_order.inc";
-$a = new Stringable("A");
-$c = new Stringable("C");
-$f = new Stringable("F");
-$g = new Stringable("G");
-$i = new Stringable("I");
+$a = new StringCapable("A");
+$c = new StringCapable("C");
+$f = new StringCapable("F");
+$g = new StringCapable("G");
+$i = new StringCapable("I");
$k = new IndexableRetrievable("K", new Indexable([
"A" => "offset value for A",
diff --git a/Zend/tests/list_keyed_undefined.phpt b/Zend/tests/list_keyed_undefined.phpt
index 3d1939c5ac..df4aa67f13 100644
--- a/Zend/tests/list_keyed_undefined.phpt
+++ b/Zend/tests/list_keyed_undefined.phpt
@@ -14,8 +14,8 @@ var_dump($five, $duke);
?>
--EXPECTF--
-Notice: Undefined offset: 5 in %s on line %d
+Warning: Undefined array key 5 in %s on line %d
-Notice: Undefined index: duke in %s on line %d
+Warning: Undefined array key "duke" in %s on line %d
NULL
NULL
diff --git a/Zend/tests/lsb_001.phpt b/Zend/tests/lsb_001.phpt
index 075109259a..72b5c24d32 100644
--- a/Zend/tests/lsb_001.phpt
+++ b/Zend/tests/lsb_001.phpt
@@ -4,33 +4,33 @@ ZE2 Late Static Binding in a static function
<?php
class TestClass {
- protected static $staticVar = 'TestClassStatic';
- const CLASS_CONST = 'TestClassConst';
+ protected static $staticVar = 'TestClassStatic';
+ const CLASS_CONST = 'TestClassConst';
- protected static function staticFunction() {
- return 'TestClassFunction';
- }
+ protected static function staticFunction() {
+ return 'TestClassFunction';
+ }
- public static function testStaticVar() {
- return static::$staticVar;
- }
+ public static function testStaticVar() {
+ return static::$staticVar;
+ }
- public static function testClassConst() {
- return static::CLASS_CONST;
- }
+ public static function testClassConst() {
+ return static::CLASS_CONST;
+ }
- public static function testStaticFunction() {
- return static::staticFunction();
- }
+ public static function testStaticFunction() {
+ return static::staticFunction();
+ }
}
class ChildClass1 extends TestClass {
- protected static $staticVar = 'ChildClassStatic';
- const CLASS_CONST = 'ChildClassConst';
+ protected static $staticVar = 'ChildClassStatic';
+ const CLASS_CONST = 'ChildClassConst';
- protected static function staticFunction() {
- return 'ChildClassFunction';
- }
+ protected static function staticFunction() {
+ return 'ChildClassFunction';
+ }
}
class ChildClass2 extends TestClass {}
@@ -47,7 +47,6 @@ echo ChildClass2::testStaticVar() . "\n";
echo ChildClass2::testClassConst() . "\n";
echo ChildClass2::testStaticFunction() . "\n";
?>
-==DONE==
--EXPECT--
TestClassStatic
TestClassConst
@@ -58,4 +57,3 @@ ChildClassFunction
TestClassStatic
TestClassConst
TestClassFunction
-==DONE==
diff --git a/Zend/tests/lsb_002.phpt b/Zend/tests/lsb_002.phpt
index 1f433c3038..8d765bb116 100644
--- a/Zend/tests/lsb_002.phpt
+++ b/Zend/tests/lsb_002.phpt
@@ -4,33 +4,33 @@ ZE2 Late Static Binding in an instance function
<?php
class TestClass {
- protected static $staticVar = 'TestClassStatic';
- const CLASS_CONST = 'TestClassConst';
+ protected static $staticVar = 'TestClassStatic';
+ const CLASS_CONST = 'TestClassConst';
- protected static function staticFunction() {
- return 'TestClassFunction';
- }
+ protected static function staticFunction() {
+ return 'TestClassFunction';
+ }
- public function testStaticVar() {
- return static::$staticVar;
- }
+ public function testStaticVar() {
+ return static::$staticVar;
+ }
- public function testClassConst() {
- return static::CLASS_CONST;
- }
+ public function testClassConst() {
+ return static::CLASS_CONST;
+ }
- public function testStaticFunction() {
- return static::staticFunction();
- }
+ public function testStaticFunction() {
+ return static::staticFunction();
+ }
}
class ChildClass1 extends TestClass {
- protected static $staticVar = 'ChildClassStatic';
- const CLASS_CONST = 'ChildClassConst';
+ protected static $staticVar = 'ChildClassStatic';
+ const CLASS_CONST = 'ChildClassConst';
- protected static function staticFunction() {
- return 'ChildClassFunction';
- }
+ protected static function staticFunction() {
+ return 'ChildClassFunction';
+ }
}
class ChildClass2 extends TestClass {}
@@ -52,7 +52,6 @@ echo $childClass2->testStaticVar() . "\n";
echo $childClass2->testClassConst() . "\n";
echo $childClass2->testStaticFunction() . "\n";
?>
-==DONE==
--EXPECT--
TestClassStatic
TestClassConst
@@ -63,4 +62,3 @@ ChildClassFunction
TestClassStatic
TestClassConst
TestClassFunction
-==DONE==
diff --git a/Zend/tests/lsb_003.phpt b/Zend/tests/lsb_003.phpt
index a7a787e568..0588b1bb60 100644
--- a/Zend/tests/lsb_003.phpt
+++ b/Zend/tests/lsb_003.phpt
@@ -4,9 +4,9 @@ ZE2 Late Static Binding creating a new class with 'static'
<?php
class TestClass {
- public static function createInstance() {
- return new static();
- }
+ public static function createInstance() {
+ return new static();
+ }
}
class ChildClass extends TestClass {}
@@ -17,8 +17,6 @@ $childClass = ChildClass::createInstance();
echo get_class($testClass) . "\n";
echo get_class($childClass) . "\n";
?>
-==DONE==
--EXPECT--
TestClass
ChildClass
-==DONE==
diff --git a/Zend/tests/lsb_004.phpt b/Zend/tests/lsb_004.phpt
index 9583ef2547..84d6ad35f0 100644
--- a/Zend/tests/lsb_004.phpt
+++ b/Zend/tests/lsb_004.phpt
@@ -4,9 +4,9 @@ ZE2 Late Static Binding testing get_called_class()
<?php
class TestClass {
- public static function getClassName() {
- return get_called_class();
- }
+ public static function getClassName() {
+ return get_called_class();
+ }
}
class ChildClass extends TestClass {}
@@ -14,8 +14,6 @@ class ChildClass extends TestClass {}
echo TestClass::getClassName() . "\n";
echo ChildClass::getClassName() . "\n";
?>
-==DONE==
--EXPECT--
TestClass
ChildClass
-==DONE==
diff --git a/Zend/tests/lsb_005.phpt b/Zend/tests/lsb_005.phpt
index a01ccd7ca9..e3ed92e215 100644
--- a/Zend/tests/lsb_005.phpt
+++ b/Zend/tests/lsb_005.phpt
@@ -4,29 +4,29 @@ ZE2 Late Static Binding stacking static calleds
<?php
class TestA {
- public static function test() {
- echo get_class(new static()) . "\n";
- TestB::test();
- echo get_class(new static()) . "\n";
- TestC::test();
- echo get_class(new static()) . "\n";
- TestBB::test();
- echo get_class(new static()) . "\n";
- }
+ public static function test() {
+ echo get_class(new static()) . "\n";
+ TestB::test();
+ echo get_class(new static()) . "\n";
+ TestC::test();
+ echo get_class(new static()) . "\n";
+ TestBB::test();
+ echo get_class(new static()) . "\n";
+ }
}
class TestB {
- public static function test() {
- echo get_class(new static()) . "\n";
- TestC::test();
- echo get_class(new static()) . "\n";
- }
+ public static function test() {
+ echo get_class(new static()) . "\n";
+ TestC::test();
+ echo get_class(new static()) . "\n";
+ }
}
class TestC {
- public static function test() {
- echo get_class(new static()) . "\n";
- }
+ public static function test() {
+ echo get_class(new static()) . "\n";
+ }
}
class TestBB extends TestB {
@@ -35,7 +35,6 @@ class TestBB extends TestB {
TestA::test();
?>
-==DONE==
--EXPECT--
TestA
TestB
@@ -48,4 +47,3 @@ TestBB
TestC
TestBB
TestA
-==DONE==
diff --git a/Zend/tests/lsb_006.phpt b/Zend/tests/lsb_006.phpt
index b10b742463..9d1600d425 100644
--- a/Zend/tests/lsb_006.phpt
+++ b/Zend/tests/lsb_006.phpt
@@ -9,4 +9,4 @@ class Foo extends static {
?>
==DONE==
--EXPECTF--
-Parse error: %s error,%sexpecting %s in %s on line %d
+Fatal error: Cannot use 'static' as class name, as it is reserved in %s on line %d
diff --git a/Zend/tests/lsb_007.phpt b/Zend/tests/lsb_007.phpt
index c28e815be0..970044eab2 100644
--- a/Zend/tests/lsb_007.phpt
+++ b/Zend/tests/lsb_007.phpt
@@ -9,4 +9,4 @@ class Foo implements static {
?>
==DONE==
--EXPECTF--
-Parse error: %s error,%sexpecting %s in %s on line %d
+Fatal error: Cannot use 'static' as interface name, as it is reserved in %s on line %d
diff --git a/Zend/tests/lsb_008.phpt b/Zend/tests/lsb_008.phpt
index 79f906bd7e..02bc93fa86 100644
--- a/Zend/tests/lsb_008.phpt
+++ b/Zend/tests/lsb_008.phpt
@@ -4,5 +4,6 @@ ZE2 Late Static Binding class name "static"
<?php
class static {
}
+?>
--EXPECTF--
Parse error: %s error,%sexpecting %s in %s on line %d
diff --git a/Zend/tests/lsb_009.phpt b/Zend/tests/lsb_009.phpt
index 9b1686391b..0a72130ff2 100644
--- a/Zend/tests/lsb_009.phpt
+++ b/Zend/tests/lsb_009.phpt
@@ -4,5 +4,6 @@ ZE2 Late Static Binding interface name "static"
<?php
interface static {
}
+?>
--EXPECTF--
Parse error: %s error,%sexpecting %s in %s on line %d
diff --git a/Zend/tests/lsb_010.phpt b/Zend/tests/lsb_010.phpt
index c6ef2d8614..5bba029e51 100644
--- a/Zend/tests/lsb_010.phpt
+++ b/Zend/tests/lsb_010.phpt
@@ -4,20 +4,20 @@ ZE2 Late Static Binding using static:: in functions called by non execute() call
<?php
class Foo {
- protected static $className = 'Foo';
- public static function bar() {
- echo static::$className . "::bar\n";
- }
- public function __construct() {
- echo static::$className . "::__construct\n";
- }
- public function __destruct() {
- echo static::$className . "::__destruct\n";
- }
+ protected static $className = 'Foo';
+ public static function bar() {
+ echo static::$className . "::bar\n";
+ }
+ public function __construct() {
+ echo static::$className . "::__construct\n";
+ }
+ public function __destruct() {
+ echo static::$className . "::__destruct\n";
+ }
}
class FooChild extends Foo {
- protected static $className = 'FooChild';
+ protected static $className = 'FooChild';
}
register_shutdown_function(array('Foo', 'bar'));
diff --git a/Zend/tests/lsb_011.phpt b/Zend/tests/lsb_011.phpt
index 3c5bbbeb6f..206f0cb9d0 100644
--- a/Zend/tests/lsb_011.phpt
+++ b/Zend/tests/lsb_011.phpt
@@ -4,18 +4,18 @@ ZE2 Late Static Binding call to static::method() from internal function (array)
<?php
class Test1 {
- static function ok() {
- echo "bug";
- }
- static function test() {
- call_user_func(array("static","ok"));
- }
+ static function ok() {
+ echo "bug";
+ }
+ static function test() {
+ call_user_func(array("static","ok"));
+ }
}
class Test2 extends Test1 {
- static function ok() {
- echo "ok";
- }
+ static function ok() {
+ echo "ok";
+ }
}
Test2::test();
?>
diff --git a/Zend/tests/lsb_012.phpt b/Zend/tests/lsb_012.phpt
index 3ac8d38840..21ddff3524 100644
--- a/Zend/tests/lsb_012.phpt
+++ b/Zend/tests/lsb_012.phpt
@@ -4,18 +4,18 @@ ZE2 Late Static Binding call to static::method() from internal function (string)
<?php
class Test1 {
- static function ok() {
- echo "bug";
- }
- static function test() {
- call_user_func("static::ok");
- }
+ static function ok() {
+ echo "bug";
+ }
+ static function test() {
+ call_user_func("static::ok");
+ }
}
class Test2 extends Test1 {
- static function ok() {
- echo "ok";
- }
+ static function ok() {
+ echo "ok";
+ }
}
Test2::test();
?>
diff --git a/Zend/tests/lsb_013.phpt b/Zend/tests/lsb_013.phpt
index 3f32dc3a66..3af7f1bea7 100644
--- a/Zend/tests/lsb_013.phpt
+++ b/Zend/tests/lsb_013.phpt
@@ -4,15 +4,15 @@ ZE2 Late Static Binding is_callable() and static::method()
<?php
class Test1 {
- static function test() {
- var_dump(is_callable("static::ok"));
- var_dump(is_callable(array("static","ok")));
- }
+ static function test() {
+ var_dump(is_callable("static::ok"));
+ var_dump(is_callable(array("static","ok")));
+ }
}
class Test2 extends Test1 {
- static function ok() {
- }
+ static function ok() {
+ }
}
Test1::test();
Test2::test();
diff --git a/Zend/tests/lsb_014.phpt b/Zend/tests/lsb_014.phpt
index 19cf913710..2b7219a989 100644
--- a/Zend/tests/lsb_014.phpt
+++ b/Zend/tests/lsb_014.phpt
@@ -4,16 +4,16 @@ ZE2 Late Static Binding access to static::const through defined() and get_consta
<?php
class Test1 {
- static function test() {
- var_dump(defined("static::ok"));
- if (defined("static::ok")) {
- echo constant("static::ok");
- }
- }
+ static function test() {
+ var_dump(defined("static::ok"));
+ if (defined("static::ok")) {
+ echo constant("static::ok");
+ }
+ }
}
class Test2 extends Test1 {
- const ok = "ok";
+ const ok = "ok";
}
Test1::test();
Test2::test();
diff --git a/Zend/tests/lsb_015.phpt b/Zend/tests/lsb_015.phpt
index 5c40c13160..10df17686b 100644
--- a/Zend/tests/lsb_015.phpt
+++ b/Zend/tests/lsb_015.phpt
@@ -67,7 +67,6 @@ A::myCatch();
echo "via B:\n";
B::myCatch();
?>
-==DONE==
--EXPECT--
via A:
A
@@ -89,4 +88,3 @@ B
B
B
B
-==DONE==
diff --git a/Zend/tests/lsb_016.phpt b/Zend/tests/lsb_016.phpt
index 4c5fa3248e..b585a9fb6c 100644
--- a/Zend/tests/lsb_016.phpt
+++ b/Zend/tests/lsb_016.phpt
@@ -33,9 +33,7 @@ $o->test();
$o->a = "b";
echo $o->a;
?>
-==DONE==
--EXPECT--
TestChild
TestChild
TestChild
-==DONE==
diff --git a/Zend/tests/lsb_017.phpt b/Zend/tests/lsb_017.phpt
index 5f5ca4351f..5088eee7bb 100644
--- a/Zend/tests/lsb_017.phpt
+++ b/Zend/tests/lsb_017.phpt
@@ -3,12 +3,12 @@ ZE2 Late Static Binding nested calls
--FILE--
<?php
class A {
- public static function test($x=null) {
- if (!is_null($x)) {
- echo "$x\n";
- }
- return get_called_class();
- }
+ public static function test($x=null) {
+ if (!is_null($x)) {
+ echo "$x\n";
+ }
+ return get_called_class();
+ }
}
class B extends A {
@@ -20,10 +20,8 @@ class D extends A {
echo A::test(B::test(C::test(D::test())))."\n";
?>
-==DONE==
--EXPECT--
D
C
B
A
-==DONE==
diff --git a/Zend/tests/lsb_018.phpt b/Zend/tests/lsb_018.phpt
index c7877cddf7..6f05b5f53c 100644
--- a/Zend/tests/lsb_018.phpt
+++ b/Zend/tests/lsb_018.phpt
@@ -4,26 +4,26 @@ ZE2 Late Static Binding and Singleton
<?php
abstract class Singleton
{
- static private $instances = array();
- static private $nextInstanceId = 0;
- private $instanceId = NULL;
- static final public function getInstance()
- {
- $caller = get_called_class();
- if (!isset(self::$instances[$caller])) {
- self::$instances[$caller] = new $caller;
- self::$instances[$caller]->instanceId = self::$nextInstanceId++;
- }
- return self::$instances[$caller];
- }
- public final function getInstanceId()
- {
- return $this->instanceId;
- }
- public final function identify()
- {
- var_dump($this);
- }
+ static private $instances = array();
+ static private $nextInstanceId = 0;
+ private $instanceId = NULL;
+ static final public function getInstance()
+ {
+ $caller = get_called_class();
+ if (!isset(self::$instances[$caller])) {
+ self::$instances[$caller] = new $caller;
+ self::$instances[$caller]->instanceId = self::$nextInstanceId++;
+ }
+ return self::$instances[$caller];
+ }
+ public final function getInstanceId()
+ {
+ return $this->instanceId;
+ }
+ public final function identify()
+ {
+ var_dump($this);
+ }
}
class Foo extends Singleton {
@@ -54,7 +54,6 @@ $x->identify();
$y->identify();
$z->identify();
?>
-===DONE===
--EXPECTF--
object(Foo)#%d (1) {
["instanceId":"Singleton":private]=>
@@ -92,4 +91,3 @@ object(Baz)#%d (1) {
["instanceId":"Singleton":private]=>
int(2)
}
-===DONE===
diff --git a/Zend/tests/lsb_019.phpt b/Zend/tests/lsb_019.phpt
index 4073dac8d8..74d674dc73 100644
--- a/Zend/tests/lsb_019.phpt
+++ b/Zend/tests/lsb_019.phpt
@@ -3,29 +3,29 @@ ZE2 Late Static Binding properties and methods declared as protected and overrid
--FILE--
<?php
class TestClass {
- protected static $staticVar;
+ protected static $staticVar;
- protected static function staticFunction() {
- return 'TestClassFunction';
- }
+ protected static function staticFunction() {
+ return 'TestClassFunction';
+ }
- public static function testStaticVar() {
- TestClass::$staticVar = 'TestClassStatic';
- ChildClass1::$staticVar = 'ChildClassStatic';
- return static::$staticVar;
- }
+ public static function testStaticVar() {
+ TestClass::$staticVar = 'TestClassStatic';
+ ChildClass1::$staticVar = 'ChildClassStatic';
+ return static::$staticVar;
+ }
- public static function testStaticFunction() {
- return static::staticFunction();
- }
+ public static function testStaticFunction() {
+ return static::staticFunction();
+ }
}
class ChildClass1 extends TestClass {
- public static $staticVar;
+ public static $staticVar;
- public static function staticFunction() {
- return 'ChildClassFunction';
- }
+ public static function staticFunction() {
+ return 'ChildClassFunction';
+ }
}
class ChildClass2 extends TestClass {}
diff --git a/Zend/tests/lsb_020.phpt b/Zend/tests/lsb_020.phpt
index cc5b257c34..d38017ca05 100644
--- a/Zend/tests/lsb_020.phpt
+++ b/Zend/tests/lsb_020.phpt
@@ -3,29 +3,29 @@ ZE2 Late Static Binding properties and methods declared as public and overridden
--FILE--
<?php
class TestClass {
- public static $staticVar;
+ public static $staticVar;
- public static function staticFunction() {
- return 'TestClassFunction';
- }
+ public static function staticFunction() {
+ return 'TestClassFunction';
+ }
- public static function testStaticVar() {
- TestClass::$staticVar = 'TestClassStatic';
- ChildClass1::$staticVar = 'ChildClassStatic';
- return static::$staticVar;
- }
+ public static function testStaticVar() {
+ TestClass::$staticVar = 'TestClassStatic';
+ ChildClass1::$staticVar = 'ChildClassStatic';
+ return static::$staticVar;
+ }
- public static function testStaticFunction() {
- return static::staticFunction();
- }
+ public static function testStaticFunction() {
+ return static::staticFunction();
+ }
}
class ChildClass1 extends TestClass {
- public static $staticVar;
+ public static $staticVar;
- public static function staticFunction() {
- return 'ChildClassFunction';
- }
+ public static function staticFunction() {
+ return 'ChildClassFunction';
+ }
}
class ChildClass2 extends TestClass {}
diff --git a/Zend/tests/lsb_021.phpt b/Zend/tests/lsb_021.phpt
index a99ea4dd22..5694537a04 100644
--- a/Zend/tests/lsb_021.phpt
+++ b/Zend/tests/lsb_021.phpt
@@ -24,6 +24,10 @@ class B extends A {
B::test();
call_user_func("B::test");
call_user_func(array("B", "test"));
+
+ (self::class)::test();
+ call_user_func(self::class . "::test");
+ call_user_func(array(self::class, "test"));
}
}
@@ -48,3 +52,6 @@ A
B
B
B
+B
+B
+B
diff --git a/Zend/tests/lsb_022.phpt b/Zend/tests/lsb_022.phpt
index 016fde83c9..e2a405c53e 100644
--- a/Zend/tests/lsb_022.phpt
+++ b/Zend/tests/lsb_022.phpt
@@ -3,26 +3,27 @@ ZE2 Late Static Binding parent::/self:: forwarding and __callStatic
--FILE--
<?php
class A {
- static function test() {
- echo "A\n";
- }
- static function __callstatic($name, $args) {
- call_user_func("static::test");
- }
+ static function test() {
+ echo "A\n";
+ }
+ static function __callstatic($name, $args) {
+ call_user_func("static::test");
+ }
}
class B extends A {
- static function test() {
- echo "B\n";
- }
- static function __callstatic($name, $args) {
- parent::__callstatic($name, $args);
- call_user_func_array("parent::__callstatic", array($name, $args));
- parent::foo();
- call_user_func_array("parent::foo", $args);
- call_user_func_array(array("parent","foo"), $args);
- }
+ static function test() {
+ echo "B\n";
+ }
+ static function __callstatic($name, $args) {
+ parent::__callstatic($name, $args);
+ call_user_func_array("parent::__callstatic", array($name, $args));
+ parent::foo();
+ call_user_func_array("parent::foo", $args);
+ call_user_func_array(array("parent","foo"), $args);
+ }
}
B::foo();
+?>
--EXPECT--
B
B
diff --git a/Zend/tests/magic_methods_001.phpt b/Zend/tests/magic_methods_001.phpt
index 412702ded5..a2f463f8c1 100644
--- a/Zend/tests/magic_methods_001.phpt
+++ b/Zend/tests/magic_methods_001.phpt
@@ -4,25 +4,25 @@ Testing several magic methods
<?php
class foo {
- function __unset($a) {
- print "unset\n";
- var_dump($a);
- }
-
- public function __call($a, $b) {
- print "call\n";
- var_dump($a);
- }
- function __clone() {
- print "clone\n";
- }
- static public function __callstatic($a, $b) {
- print "callstatic\n";
- }
-
- public function __tostring() {
- return 'foo';
- }
+ function __unset($a) {
+ print "unset\n";
+ var_dump($a);
+ }
+
+ public function __call($a, $b) {
+ print "call\n";
+ var_dump($a);
+ }
+ function __clone() {
+ print "clone\n";
+ }
+ static public function __callstatic($a, $b) {
+ print "callstatic\n";
+ }
+
+ public function __tostring() {
+ return 'foo';
+ }
}
diff --git a/Zend/tests/magic_methods_002.phpt b/Zend/tests/magic_methods_002.phpt
index 08b7f4497f..56868013bf 100644
--- a/Zend/tests/magic_methods_002.phpt
+++ b/Zend/tests/magic_methods_002.phpt
@@ -4,11 +4,11 @@ Testing __unset with private visibility
<?php
class foo {
- private function __unset($a) {
- print "unset\n";
- }
+ private function __unset($a) {
+ print "unset\n";
+ }
}
?>
--EXPECTF--
-Warning: The magic method __unset() must have public visibility and cannot be static in %s on line %d
+Warning: The magic method foo::__unset() must have public visibility in %s on line %d
diff --git a/Zend/tests/magic_methods_003.phpt b/Zend/tests/magic_methods_003.phpt
index 7e965ba3fd..d85983a419 100644
--- a/Zend/tests/magic_methods_003.phpt
+++ b/Zend/tests/magic_methods_003.phpt
@@ -4,11 +4,11 @@ Testing __unset declaring as static
<?php
class foo {
- static function __unset($a) {
- print "unset\n";
- }
+ static function __unset($a) {
+ print "unset\n";
+ }
}
?>
--EXPECTF--
-Warning: The magic method __unset() must have public visibility and cannot be static in %s on line %d
+Fatal error: Method foo::__unset() cannot be static in %s on line %d
diff --git a/Zend/tests/magic_methods_004.phpt b/Zend/tests/magic_methods_004.phpt
index 8caf5d4aa1..b9ad81c6ac 100644
--- a/Zend/tests/magic_methods_004.phpt
+++ b/Zend/tests/magic_methods_004.phpt
@@ -4,11 +4,11 @@ Testing __unset() with protected visibility
<?php
class foo {
- protected function __unset($a) {
- print "unset\n";
- }
+ protected function __unset($a) {
+ print "unset\n";
+ }
}
?>
--EXPECTF--
-Warning: The magic method __unset() must have public visibility and cannot be static in %s on line %d
+Warning: The magic method foo::__unset() must have public visibility in %s on line %d
diff --git a/Zend/tests/magic_methods_005.phpt b/Zend/tests/magic_methods_005.phpt
index 76ab30087e..cac833f0ce 100644
--- a/Zend/tests/magic_methods_005.phpt
+++ b/Zend/tests/magic_methods_005.phpt
@@ -4,9 +4,9 @@ Testing __call() declaration in interface with wrong modifier
<?php
interface a {
- static function __call($a, $b);
+ static function __call($a, $b);
}
?>
--EXPECTF--
-Warning: The magic method __call() must have public visibility and cannot be static in %s on line %d
+Fatal error: Method a::__call() cannot be static in %s on line %d
diff --git a/Zend/tests/magic_methods_006.phpt b/Zend/tests/magic_methods_006.phpt
index 2e84a41c5c..0a83a448ef 100644
--- a/Zend/tests/magic_methods_006.phpt
+++ b/Zend/tests/magic_methods_006.phpt
@@ -4,9 +4,9 @@ Testing __callstatic declaration in interface with missing the 'static' modifier
<?php
interface a {
- function __callstatic($a, $b);
+ function __callstatic($a, $b);
}
?>
--EXPECTF--
-Warning: The magic method __callStatic() must have public visibility and be static in %s on line %d
+Fatal error: Method a::__callstatic() must be static in %s on line %d
diff --git a/Zend/tests/magic_methods_007.phpt b/Zend/tests/magic_methods_007.phpt
index 0630c63e9f..5e0379060b 100644
--- a/Zend/tests/magic_methods_007.phpt
+++ b/Zend/tests/magic_methods_007.phpt
@@ -4,11 +4,9 @@ Testing __set() declaration in abstract class with wrong modifier
<?php
abstract class b {
- abstract protected function __set($a);
+ abstract protected function __set($a);
}
?>
--EXPECTF--
-Warning: The magic method __set() must have public visibility and cannot be static in %s on line %d
-
Fatal error: Method b::__set() must take exactly 2 arguments in %s on line %d
diff --git a/Zend/tests/magic_methods_008.phpt b/Zend/tests/magic_methods_008.phpt
index 25731516e6..3ddeb61d24 100644
--- a/Zend/tests/magic_methods_008.phpt
+++ b/Zend/tests/magic_methods_008.phpt
@@ -4,16 +4,16 @@ Testing __set implementation with wrong declaration
<?php
abstract class b {
- abstract function __set($a, $b);
+ abstract function __set($a, $b);
}
class a extends b {
- private function __set($a, $b) {
- }
+ private function __set($a, $b) {
+ }
}
?>
--EXPECTF--
-Warning: The magic method __set() must have public visibility and cannot be static in %s on line %d
+Warning: The magic method a::__set() must have public visibility in %s on line %d
Fatal error: Access level to a::__set() must be public (as in class b) in %s on line 8
diff --git a/Zend/tests/magic_methods_009.phpt b/Zend/tests/magic_methods_009.phpt
index 2b514c3bff..4ed33225ff 100644
--- a/Zend/tests/magic_methods_009.phpt
+++ b/Zend/tests/magic_methods_009.phpt
@@ -4,10 +4,10 @@ Testing __callstatic declaration with wrong modifier
<?php
class a {
- static protected function __callstatic($a, $b) {
- }
+ static protected function __callstatic($a, $b) {
+ }
}
?>
--EXPECTF--
-Warning: The magic method __callStatic() must have public visibility and be static in %s on line %d
+Warning: The magic method a::__callstatic() must have public visibility in %s on line %d
diff --git a/Zend/tests/magic_methods_010.phpt b/Zend/tests/magic_methods_010.phpt
index 06d46dbd28..3562189c34 100644
--- a/Zend/tests/magic_methods_010.phpt
+++ b/Zend/tests/magic_methods_010.phpt
@@ -4,12 +4,10 @@ Testing __toString() declaration with wrong modifier
<?php
class a {
- static protected function __toString($a, $b) {
- }
+ static protected function __toString($a, $b) {
+ }
}
?>
--EXPECTF--
-Warning: The magic method __toString() must have public visibility and cannot be static in %s on line %d
-
-Fatal error: Method a::__tostring() cannot take arguments in %s on line %d
+Fatal error: Method a::__toString() cannot take arguments in %s on line %d
diff --git a/Zend/tests/magic_methods_011.phpt b/Zend/tests/magic_methods_011.phpt
new file mode 100644
index 0000000000..7cd4d4bee1
--- /dev/null
+++ b/Zend/tests/magic_methods_011.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__set first parameter should be a string when typed
+--FILE--
+<?php
+class Foo {
+ function __set(\Countable $name, $value) {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__set(): Parameter #1 ($name) must be of type string when declared in %s on line %d
diff --git a/Zend/tests/magic_methods_012.phpt b/Zend/tests/magic_methods_012.phpt
new file mode 100644
index 0000000000..450c7b2295
--- /dev/null
+++ b/Zend/tests/magic_methods_012.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__get first parameter should be a string when typed
+--FILE--
+<?php
+class Foo {
+ function __get(int $name) {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__get(): Parameter #1 ($name) must be of type string when declared in %s on line %d
diff --git a/Zend/tests/magic_methods_013.phpt b/Zend/tests/magic_methods_013.phpt
new file mode 100644
index 0000000000..95614779d5
--- /dev/null
+++ b/Zend/tests/magic_methods_013.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__isset first parameter should be a string when typed
+--FILE--
+<?php
+class Foo {
+ function __isset(\stdClass $name) {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__isset(): Parameter #1 ($name) must be of type string when declared in %s on line %d
diff --git a/Zend/tests/magic_methods_014.phpt b/Zend/tests/magic_methods_014.phpt
new file mode 100644
index 0000000000..8a1aa6388d
--- /dev/null
+++ b/Zend/tests/magic_methods_014.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__unset first parameter should be a string when typed
+--FILE--
+<?php
+class Foo {
+ function __unset(array $name) {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__unset(): Parameter #1 ($name) must be of type string when declared in %s on line %d
diff --git a/Zend/tests/magic_methods_015.phpt b/Zend/tests/magic_methods_015.phpt
new file mode 100644
index 0000000000..3b7cf69618
--- /dev/null
+++ b/Zend/tests/magic_methods_015.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__call first parameter should be a string typed
+--FILE--
+<?php
+class Foo {
+ function __call(int $name, array $arguments) {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__call(): Parameter #1 ($name) must be of type string when declared in %s on line %d
diff --git a/Zend/tests/magic_methods_016.phpt b/Zend/tests/magic_methods_016.phpt
new file mode 100644
index 0000000000..c456afa127
--- /dev/null
+++ b/Zend/tests/magic_methods_016.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__call second parameter should be an array when typed
+--FILE--
+<?php
+class Foo {
+ function __call(string $name, \Arguments $arguments) {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__call(): Parameter #2 ($arguments) must be of type array when declared in %s on line %d
diff --git a/Zend/tests/magic_methods_017.phpt b/Zend/tests/magic_methods_017.phpt
new file mode 100644
index 0000000000..0ce6227123
--- /dev/null
+++ b/Zend/tests/magic_methods_017.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__callStatic first parameter should be a string typed
+--FILE--
+<?php
+class Foo {
+ static function __callStatic(int $name, array $arguments) {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__callStatic(): Parameter #1 ($name) must be of type string when declared in %s on line %d
diff --git a/Zend/tests/magic_methods_018.phpt b/Zend/tests/magic_methods_018.phpt
new file mode 100644
index 0000000000..914a889808
--- /dev/null
+++ b/Zend/tests/magic_methods_018.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__callStatic second parameter should be an array typed
+--FILE--
+<?php
+class Foo {
+ static function __callStatic(string $name, \Arguments $args) {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__callStatic(): Parameter #2 ($args) must be of type array when declared in %s on line %d
diff --git a/Zend/tests/magic_methods_019.phpt b/Zend/tests/magic_methods_019.phpt
new file mode 100644
index 0000000000..f0a5fabff2
--- /dev/null
+++ b/Zend/tests/magic_methods_019.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__unserialize first parameter must be an array
+--FILE--
+<?php
+class Foo {
+ public function __unserialize(string $name) {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__unserialize(): Parameter #1 ($name) must be of type array when declared in %s on line %d
diff --git a/Zend/tests/magic_methods_020.phpt b/Zend/tests/magic_methods_020.phpt
new file mode 100644
index 0000000000..4efaf6fb18
--- /dev/null
+++ b/Zend/tests/magic_methods_020.phpt
@@ -0,0 +1,12 @@
+--TEST--
+__set_state first parameter must be an array
+--FILE--
+<?php
+
+class Foo {
+ public static function __set_state(int $properties) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Foo::__set_state(): Parameter #1 ($properties) must be of type array when declared in %s on line %d
diff --git a/Zend/tests/magic_methods_021.phpt b/Zend/tests/magic_methods_021.phpt
new file mode 100644
index 0000000000..fd3e7fa9d0
--- /dev/null
+++ b/Zend/tests/magic_methods_021.phpt
@@ -0,0 +1,21 @@
+--TEST--
+__set_state return type should support covariance
+--FILE--
+<?php
+
+class Foo {
+ public static function __set_state(array $data): self {}
+}
+
+class Foo2 {
+ public static function __set_state(array $data): static {}
+}
+
+class Foo3 {
+ public static function __set_state(array $data): Foo3|self {}
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/magic_methods_inheritance_rules.phpt b/Zend/tests/magic_methods_inheritance_rules.phpt
new file mode 100644
index 0000000000..6bdcafb1bf
--- /dev/null
+++ b/Zend/tests/magic_methods_inheritance_rules.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Magic Methods inheritance rules
+--FILE--
+<?php
+class ValidMagicMethods {
+ public function __call(string $name, array $arguments): mixed {}
+
+ public static function __callStatic(string $name, array $arguments): mixed {}
+
+ public function __clone(): void {}
+
+ public function __debugInfo(): ?array {}
+
+ public function __get(string $name): mixed {}
+
+ public function __invoke(mixed $arguments): mixed {}
+
+ public function __isset(string $name): bool {}
+
+ public function __serialize(): array {}
+
+ public function __set(string $name, mixed $value): void {}
+
+ public static function __set_state(array $properties): object {}
+
+ public function __sleep(): array {}
+
+ public function __toString(): string {}
+
+ public function __unserialize(array $data): void {}
+
+ public function __unset(string $name): void {}
+
+ public function __wakeup(): void {}
+}
+
+class NarrowedReturnType extends ValidMagicMethods {
+ public function __call(string $name, array $arguments): string|float|null {}
+
+ public static function __callStatic(string $name, array $arguments): ?array {}
+
+ public function __debugInfo(): array {}
+
+ public function __get(string $name): int|string {}
+
+ public function __invoke(mixed $arguments): object {}
+}
+
+class WidenedArgumentType extends NarrowedReturnType {
+ public function __call(string|array $name, array|string $arguments): string|float|null {}
+
+ public static function __callStatic(string|object $name, array|object $arguments): ?array {}
+
+ public function __get(string|array $name): int|string {}
+
+ public function __isset(string|bool $name): bool {}
+
+ public function __set(string|bool|float $name, mixed $value): void {}
+
+ public static function __set_state(string|array $properties): object {}
+
+ public function __unserialize(array|string $data): void {}
+
+ public function __unset(string|array $name): void {}
+}
+
+echo 'No problems!';
+?>
+--EXPECT--
+No problems!
diff --git a/Zend/tests/magic_methods_inheritance_rules_non_trivial_01.phpt b/Zend/tests/magic_methods_inheritance_rules_non_trivial_01.phpt
new file mode 100644
index 0000000000..84a960240a
--- /dev/null
+++ b/Zend/tests/magic_methods_inheritance_rules_non_trivial_01.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Magic Methods inheritance rules on a non-trivial class hierarchy
+--FILE--
+<?php
+class A {
+ public function __get(string|array $name): mixed {} // valid
+}
+
+class B extends A {
+ public function __get(string|array|object $name): int {} // also valid
+}
+
+class C extends B {
+ public function __get(string|array $name): int {} // this is invalid
+}
+?>
+--EXPECTF--
+Fatal error: Declaration of C::__get(array|string $name): int must be compatible with B::__get(object|array|string $name): int in %s on line %d
diff --git a/Zend/tests/magic_methods_inheritance_rules_non_trivial_02.phpt b/Zend/tests/magic_methods_inheritance_rules_non_trivial_02.phpt
new file mode 100644
index 0000000000..2835b46830
--- /dev/null
+++ b/Zend/tests/magic_methods_inheritance_rules_non_trivial_02.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Magic Methods inheritance rules on a non-trivial class hierarchy
+--FILE--
+<?php
+class A {
+ public function __get(string|array $name): mixed {} // valid
+}
+
+class B extends A {
+ public function __get(string|array|object $name): int {} // also valid
+}
+
+class C extends B {
+ public function __get(string|array|object $name): int|float {} // this is invalid
+}
+?>
+--EXPECTF--
+Fatal error: Declaration of C::__get(object|array|string $name): int|float must be compatible with B::__get(object|array|string $name): int in %s on line %d
diff --git a/Zend/tests/magic_methods_serialize.phpt b/Zend/tests/magic_methods_serialize.phpt
new file mode 100644
index 0000000000..2970c4f36c
--- /dev/null
+++ b/Zend/tests/magic_methods_serialize.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__serialize declaration
+--FILE--
+<?php
+class Foo {
+ static function __serialize($arguments) {}
+}
+?>
+--EXPECTF--
+Fatal error: Method Foo::__serialize() cannot take arguments in %s on line %d
diff --git a/Zend/tests/magic_methods_set_state.phpt b/Zend/tests/magic_methods_set_state.phpt
new file mode 100644
index 0000000000..301dbb84da
--- /dev/null
+++ b/Zend/tests/magic_methods_set_state.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Testing __set_state() declaration with wrong modifier
+--FILE--
+<?php
+
+class Foo {
+ function __set_state($array)
+ {
+ }
+}
+
+?>
+--EXPECTF--
+Fatal error: Method Foo::__set_state() must be static in %s on line %d
diff --git a/Zend/tests/magic_methods_sleep.phpt b/Zend/tests/magic_methods_sleep.phpt
new file mode 100644
index 0000000000..89baac4699
--- /dev/null
+++ b/Zend/tests/magic_methods_sleep.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__sleep cannot take arguments
+--FILE--
+<?php
+class Foo {
+ public function __sleep(string $name) {}
+}
+?>
+--EXPECTF--
+Fatal error: Method Foo::__sleep() cannot take arguments in %s on line %d
diff --git a/Zend/tests/magic_methods_unserialize.phpt b/Zend/tests/magic_methods_unserialize.phpt
new file mode 100644
index 0000000000..b0a867c74d
--- /dev/null
+++ b/Zend/tests/magic_methods_unserialize.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__unserialize declaration
+--FILE--
+<?php
+class Foo {
+ static function __unserialize($data, $value) {}
+}
+?>
+--EXPECTF--
+Fatal error: Method Foo::__unserialize() must take exactly 1 argument in %s on line %d
diff --git a/Zend/tests/magic_methods_wakeup.phpt b/Zend/tests/magic_methods_wakeup.phpt
new file mode 100644
index 0000000000..8d72b6be86
--- /dev/null
+++ b/Zend/tests/magic_methods_wakeup.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__wakeup cannot take arguments
+--FILE--
+<?php
+class Foo {
+ public function __wakeup(string $name) {}
+}
+?>
+--EXPECTF--
+Fatal error: Method Foo::__wakeup() cannot take arguments in %s on line %d
diff --git a/Zend/tests/match/001.phpt b/Zend/tests/match/001.phpt
new file mode 100644
index 0000000000..9d338c1b42
--- /dev/null
+++ b/Zend/tests/match/001.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Basic match expression functionality test
+--FILE--
+<?php
+
+function wordify($x) {
+ return match ($x) {
+ 0 => 'Zero',
+ 1 => 'One',
+ 2 => 'Two',
+ 3 => 'Three',
+ 4 => 'Four',
+ 5 => 'Five',
+ 6 => 'Six',
+ 7 => 'Seven',
+ 8 => 'Eight',
+ 9 => 'Nine',
+ };
+}
+
+for ($i = 0; $i <= 9; $i++) {
+ print wordify($i) . "\n";
+}
+
+?>
+--EXPECT--
+Zero
+One
+Two
+Three
+Four
+Five
+Six
+Seven
+Eight
+Nine
diff --git a/Zend/tests/match/002.phpt b/Zend/tests/match/002.phpt
new file mode 100644
index 0000000000..ad087c5926
--- /dev/null
+++ b/Zend/tests/match/002.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Match expression omit trailing comma
+--FILE--
+<?php
+
+function print_bool($bool) {
+ echo match ($bool) {
+ true => "true\n",
+ false => "false\n"
+ };
+}
+
+print_bool(true);
+print_bool(false);
+
+?>
+--EXPECT--
+true
+false
diff --git a/Zend/tests/match/003.phpt b/Zend/tests/match/003.phpt
new file mode 100644
index 0000000000..550d2277d6
--- /dev/null
+++ b/Zend/tests/match/003.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Match expression default case
+--FILE--
+<?php
+
+function get_value($i) {
+ return match ($i) {
+ 1 => 1,
+ 2 => 2,
+ default => 'default',
+ };
+}
+
+echo get_value(0) . "\n";
+echo get_value(1) . "\n";
+echo get_value(2) . "\n";
+echo get_value(3) . "\n";
+
+?>
+--EXPECT--
+default
+1
+2
+default
diff --git a/Zend/tests/match/004.phpt b/Zend/tests/match/004.phpt
new file mode 100644
index 0000000000..2f8717f74e
--- /dev/null
+++ b/Zend/tests/match/004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Match expression with true as expression
+--FILE--
+<?php
+
+function get_range($i) {
+ return match (true) {
+ $i >= 50 => '50+',
+ $i >= 40 => '40-50',
+ $i >= 30 => '30-40',
+ $i >= 20 => '20-30',
+ $i >= 10 => '10-20',
+ default => '0-10',
+ };
+}
+
+echo get_range(22) . "\n";
+echo get_range(0) . "\n";
+echo get_range(59) . "\n";
+echo get_range(13) . "\n";
+echo get_range(39) . "\n";
+echo get_range(40) . "\n";
+
+?>
+--EXPECT--
+20-30
+0-10
+50+
+10-20
+30-40
+40-50
diff --git a/Zend/tests/match/005.phpt b/Zend/tests/match/005.phpt
new file mode 100644
index 0000000000..cc72739f43
--- /dev/null
+++ b/Zend/tests/match/005.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Match expression discarding result
+--FILE--
+<?php
+
+match (1) {
+ 1 => print "Executed\n",
+};
+
+?>
+--EXPECT--
+Executed
diff --git a/Zend/tests/match/006.phpt b/Zend/tests/match/006.phpt
new file mode 100644
index 0000000000..fec28f82da
--- /dev/null
+++ b/Zend/tests/match/006.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Match expression with no cases
+--FILE--
+<?php
+
+$x = match (true) {};
+
+?>
+--EXPECTF--
+Fatal error: Uncaught UnhandledMatchError: Unhandled match value of type bool in %s
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/match/007.phpt b/Zend/tests/match/007.phpt
new file mode 100644
index 0000000000..7b442a66a0
--- /dev/null
+++ b/Zend/tests/match/007.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Match expression exception on unhandled case
+--FILE--
+<?php
+
+function get_value($i) {
+ return match ($i) {
+ 1 => 1,
+ 2 => 2,
+ };
+}
+
+echo get_value(1) . "\n";
+echo get_value(2) . "\n";
+echo get_value(3) . "\n";
+
+?>
+--EXPECTF--
+1
+2
+
+Fatal error: Uncaught UnhandledMatchError: Unhandled match value of type int in %s
+Stack trace:
+#0 %s: get_value(3)
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/match/008.phpt b/Zend/tests/match/008.phpt
new file mode 100644
index 0000000000..db91d80b87
--- /dev/null
+++ b/Zend/tests/match/008.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Match expression multiple conditions per case
+--FILE--
+<?php
+
+function is_working_day($day) {
+ return match ($day) {
+ 1, 7 => false,
+ 2, 3, 4, 5, 6 => true,
+ };
+}
+
+for ($i = 1; $i <= 7; $i++) {
+ var_dump(is_working_day($i));
+}
+
+?>
+--EXPECT--
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
diff --git a/Zend/tests/match/009.phpt b/Zend/tests/match/009.phpt
new file mode 100644
index 0000000000..4d5b4a540f
--- /dev/null
+++ b/Zend/tests/match/009.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Pretty printing for match expression
+--INI--
+assert.exception=0
+--FILE--
+<?php
+
+assert((function () {
+ match ('foo') {
+ 'foo', 'bar' => false,
+ 'baz' => 'a',
+ default => 'b',
+ };
+})());
+
+?>
+--EXPECTF--
+Warning: assert(): assert(function () {
+ match ('foo') {
+ 'foo', 'bar' => false,
+ 'baz' => 'a',
+ default => 'b',
+ };
+}()) failed in %s on line %d
diff --git a/Zend/tests/match/011.phpt b/Zend/tests/match/011.phpt
new file mode 100644
index 0000000000..1c3c139ef7
--- /dev/null
+++ b/Zend/tests/match/011.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Implicit break in match expression
+--FILE--
+<?php
+
+function dump_and_return($string) {
+ var_dump($string);
+ return $string;
+}
+
+var_dump(match ('foo') {
+ 'foo' => dump_and_return('foo'),
+ 'bar' => dump_and_return('bar'),
+});
+
+?>
+--EXPECT--
+string(3) "foo"
+string(3) "foo"
diff --git a/Zend/tests/match/012.phpt b/Zend/tests/match/012.phpt
new file mode 100644
index 0000000000..c75fc73de8
--- /dev/null
+++ b/Zend/tests/match/012.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Strict comparison in match expression
+--FILE--
+<?php
+
+function wrong() {
+ throw new Exception();
+}
+
+var_dump(match (0) {
+ null => wrong(),
+ false => wrong(),
+ 0.0 => wrong(),
+ [] => wrong(),
+ '' => wrong(),
+ 0 => 'int',
+});
+
+function get_value() {
+ return 0;
+}
+
+var_dump(match (get_value()) {
+ null => wrong(),
+ false => wrong(),
+ 0.0 => wrong(),
+ [] => wrong(),
+ '' => wrong(),
+ 0 => 'int',
+ default => 'default',
+});
+
+?>
+--EXPECT--
+string(3) "int"
+string(3) "int"
diff --git a/Zend/tests/match/017.phpt b/Zend/tests/match/017.phpt
new file mode 100644
index 0000000000..17f07a0b13
--- /dev/null
+++ b/Zend/tests/match/017.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test strict comparison with match expression jump table
+--FILE--
+<?php
+
+function wrong() {
+ throw new Exception();
+}
+
+function test_int($char) {
+ return match ($char) {
+ 0 => wrong(),
+ 1 => wrong(),
+ 2 => wrong(),
+ 3 => wrong(),
+ 4 => wrong(),
+ 5 => wrong(),
+ 6 => wrong(),
+ 7 => wrong(),
+ 8 => wrong(),
+ 9 => wrong(),
+ default => 'Not matched',
+ };
+}
+
+foreach (range(0, 9) as $int) {
+ var_dump((string) $int);
+ var_dump(test_int((string) $int));
+}
+
+function test_string($int) {
+ return match ($int) {
+ '0' => wrong(),
+ '1' => wrong(),
+ '2' => wrong(),
+ '3' => wrong(),
+ '4' => wrong(),
+ '5' => wrong(),
+ '6' => wrong(),
+ '7' => wrong(),
+ '8' => wrong(),
+ '9' => wrong(),
+ default => 'Not matched',
+ };
+}
+
+foreach (range(0, 9) as $int) {
+ var_dump($int);
+ var_dump(test_string($int));
+}
+
+?>
+--EXPECT--
+string(1) "0"
+string(11) "Not matched"
+string(1) "1"
+string(11) "Not matched"
+string(1) "2"
+string(11) "Not matched"
+string(1) "3"
+string(11) "Not matched"
+string(1) "4"
+string(11) "Not matched"
+string(1) "5"
+string(11) "Not matched"
+string(1) "6"
+string(11) "Not matched"
+string(1) "7"
+string(11) "Not matched"
+string(1) "8"
+string(11) "Not matched"
+string(1) "9"
+string(11) "Not matched"
+int(0)
+string(11) "Not matched"
+int(1)
+string(11) "Not matched"
+int(2)
+string(11) "Not matched"
+int(3)
+string(11) "Not matched"
+int(4)
+string(11) "Not matched"
+int(5)
+string(11) "Not matched"
+int(6)
+string(11) "Not matched"
+int(7)
+string(11) "Not matched"
+int(8)
+string(11) "Not matched"
+int(9)
+string(11) "Not matched"
diff --git a/Zend/tests/match/023.phpt b/Zend/tests/match/023.phpt
new file mode 100644
index 0000000000..9b16e16a89
--- /dev/null
+++ b/Zend/tests/match/023.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test match strict comparison with true expression
+--FILE--
+<?php
+
+function wrong() {
+ throw new Exception();
+}
+
+echo match (true) {
+ 'truthy' => wrong(),
+ ['truthy'] => wrong(),
+ new stdClass() => wrong(),
+ 1 => wrong(),
+ 1.0 => wrong(),
+ true => "true\n",
+};
+
+?>
+--EXPECT--
+true
diff --git a/Zend/tests/match/024.phpt b/Zend/tests/match/024.phpt
new file mode 100644
index 0000000000..e1b8e438d6
--- /dev/null
+++ b/Zend/tests/match/024.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test match strict comparison with false expression
+--FILE--
+<?php
+
+function wrong() {
+ throw new Exception();
+}
+
+echo match (false) {
+ '' => wrong(),
+ [] => wrong(),
+ 0 => wrong(),
+ 0.0 => wrong(),
+ false => "false\n",
+};
+
+?>
+--EXPECT--
+false
diff --git a/Zend/tests/match/027.phpt b/Zend/tests/match/027.phpt
new file mode 100644
index 0000000000..00dde05bbc
--- /dev/null
+++ b/Zend/tests/match/027.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test result of match cannot be modified by reference
+--FILE--
+<?php
+
+// opcache can't be certain Test::usesRef is actually this method
+if (!class_exists('Test')) {
+ class Test {
+ public static function usesRef(&$x) {
+ $x = 'modified';
+ }
+ public static function usesValue($x) {
+ echo "usesValue $x\n";
+ }
+ }
+}
+
+function main() {
+ $i = 0;
+ Test::usesValue(match(true) { true => $i });
+ echo "i is $i\n";
+ $j = 1;
+ Test::usesRef(match(true) { true => $j });
+ echo "j is $j\n";
+}
+main();
+
+?>
+--EXPECTF--
+usesValue 0
+i is 0
+
+Fatal error: Uncaught Error: Test::usesRef(): Argument #1 ($x) cannot be passed by reference in %s:%d
+Stack trace:
+#0 %s(%d): main()
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/match/028.phpt b/Zend/tests/match/028.phpt
new file mode 100644
index 0000000000..cfc6a37de2
--- /dev/null
+++ b/Zend/tests/match/028.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test result of match cannot be modified by reference
+--FILE--
+<?php
+
+// opcache can't be certain Test::usesRef is actually this method
+if (!class_exists('Test')) {
+ class Test {
+ public static function usesRef(&$x) {
+ $x = 'modified';
+ }
+ public static function usesValue($x) {
+ echo "usesValue $x\n";
+ }
+ }
+}
+
+function main(int $i): int {
+ Test::usesValue(match(true) { true => $i });
+ Test::usesValue(match($i) { 42 => $i });
+ var_dump($i);
+ Test::usesRef(match(true) { true => $i });
+ var_dump($i);
+}
+
+try {
+ main(42);
+} catch (Error $e) {
+ printf("Caught %s\n", $e->getMessage());
+}
+
+?>
+--EXPECT--
+usesValue 42
+usesValue 42
+int(42)
+Caught Test::usesRef(): Argument #1 ($x) cannot be passed by reference
diff --git a/Zend/tests/match/029.phpt b/Zend/tests/match/029.phpt
new file mode 100644
index 0000000000..e4f9d64ea4
--- /dev/null
+++ b/Zend/tests/match/029.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test long match with undefined variable
+--FILE--
+<?php
+
+set_error_handler(function ($errno, $message) {
+ throw new Exception("Custom error handler: $message");
+});
+
+echo match ($undefVar) {
+ default => "This should not get printed with or without opcache\n",
+ 1, 2, 3, 4, 5 => "Also should not be printed\n",
+};
+
+echo "unreachable\n";
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Exception: Custom error handler: Undefined variable $undefVar in %s029.php:4
+Stack trace:
+#0 %s029.php(7): {closure}(%d, 'Undefined varia...', '%s', %d)
+#1 {main}
+ thrown in %s029.php on line 4
diff --git a/Zend/tests/match/030.phpt b/Zend/tests/match/030.phpt
new file mode 100644
index 0000000000..53588600bd
--- /dev/null
+++ b/Zend/tests/match/030.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test string match with undefined variable
+--FILE--
+<?php
+
+set_error_handler(function ($errno, $message) {
+ throw new Exception("Custom error handler: $message");
+});
+
+echo match ($undefVar) {
+ default => "This should not get printed with or without opcache\n",
+ '1', '2', '3', '4', '5' => "Also should not be printed\n",
+};
+
+echo "unreachable\n";
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Exception: Custom error handler: Undefined variable $undefVar in %s030.php:4
+Stack trace:
+#0 %s030.php(7): {closure}(%d, 'Undefined varia...', '%s', %d)
+#1 {main}
+ thrown in %s030.php on line 4
diff --git a/Zend/tests/match/037.phpt b/Zend/tests/match/037.phpt
new file mode 100644
index 0000000000..d3591fbfcb
--- /dev/null
+++ b/Zend/tests/match/037.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test match jumptable with only one arm
+--FILE--
+<?php
+
+try {
+ var_dump(match(true) {
+ 1, 2, 3, 4, 5 => 'foo',
+ });
+} catch (Error $e) {
+ var_dump((string) $e);
+}
+
+try {
+ var_dump(match(6) {
+ 1, 2, 3, 4, 5 => 'foo',
+ });
+} catch (Error $e) {
+ var_dump((string) $e);
+}
+
+try {
+ var_dump(match('3') {
+ 1, 2, 3, 4, 5 => 'foo',
+ });
+} catch (Error $e) {
+ var_dump((string) $e);
+}
+
+var_dump(match(3) {
+ 1, 2, 3, 4, 5 => 'foo',
+});
+
+var_dump(match(true) {
+ 1, 2, 3, 4, 5 => 'foo',
+ default => 'bar',
+});
+
+var_dump(match(6) {
+ 1, 2, 3, 4, 5 => 'foo',
+ default => 'bar',
+});
+
+var_dump(match('3') {
+ 1, 2, 3, 4, 5 => 'foo',
+ default => 'bar',
+});
+
+var_dump(match(3) {
+ 1, 2, 3, 4, 5 => 'foo',
+ default => 'bar',
+});
+
+?>
+--EXPECTF--
+string(%d) "UnhandledMatchError: Unhandled match value of type bool in %s037.php:4
+Stack trace:
+#0 {main}"
+string(%d) "UnhandledMatchError: Unhandled match value of type int in %s037.php:12
+Stack trace:
+#0 {main}"
+string(%d) "UnhandledMatchError: Unhandled match value of type string in %s037.php:20
+Stack trace:
+#0 {main}"
+string(3) "foo"
+string(3) "bar"
+string(3) "bar"
+string(3) "bar"
+string(3) "foo"
diff --git a/Zend/tests/match/038.phpt b/Zend/tests/match/038.phpt
new file mode 100644
index 0000000000..cc158038a9
--- /dev/null
+++ b/Zend/tests/match/038.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Test multiple default arms in match in different arms
+--FILE--
+<?php
+
+match (1) {
+ default => 'foo',
+ 1 => 'bar',
+ 2 => 'baz',
+ default => 'qux',
+};
+
+?>
+--EXPECTF--
+Fatal error: Match expressions may only contain one default arm in %s on line 7
diff --git a/Zend/tests/match/039.phpt b/Zend/tests/match/039.phpt
new file mode 100644
index 0000000000..d37aed5986
--- /dev/null
+++ b/Zend/tests/match/039.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test match with duplicate conditions
+--FILE--
+<?php
+
+$value = 1;
+
+echo match ($value) {
+ 1 => 1,
+ 2 => 2,
+ 3 => 3,
+ 4 => 4,
+ 5 => 5,
+ 1 => 6,
+};
+echo "\n";
+
+echo match ($value) {
+ 2, 1 => '2, 1',
+ 1 => 1,
+ 3 => 3,
+ 4 => 4,
+ 5 => 5,
+};
+echo "\n";
+
+echo match ($value) {
+ 1, 1 => '1, 1',
+ 2, 2 => '2, 2',
+ 3, 3 => '3, 3',
+ 4, 4 => '4, 4',
+ 5, 5 => '5, 5',
+};
+echo "\n";
+
+echo match ($value) {
+ 1 => 1,
+ 1 => 2,
+};
+echo "\n";
+
+echo match ($value) {
+ 2, 1 => '2, 1',
+ 1 => 1,
+};
+echo "\n";
+
+echo match ($value) {
+ 1, 1 => '1, 1',
+ 1 => 1,
+};
+echo "\n";
+
+?>
+--EXPECT--
+1
+2, 1
+1, 1
+1
+2, 1
+1, 1
diff --git a/Zend/tests/match/040.phpt b/Zend/tests/match/040.phpt
new file mode 100644
index 0000000000..223c3727ec
--- /dev/null
+++ b/Zend/tests/match/040.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test match with mixed int/string jumptable
+--FILE--
+<?php
+
+function test($value) {
+ echo match ($value) {
+ 1 => '1 int',
+ '1' => '1 string',
+ 2 => '2 int',
+ '2' => '2 string',
+ 3 => '3 int',
+ '3' => '3 string',
+ 4 => '4 int',
+ '4' => '4 string',
+ 5 => '5 int',
+ '5' => '5 string',
+ };
+ echo "\n";
+}
+
+test(1);
+test('1');
+test(2);
+test('2');
+test(3);
+test('3');
+test(4);
+test('4');
+test(5);
+test('5');
+
+?>
+--EXPECT--
+1 int
+1 string
+2 int
+2 string
+3 int
+3 string
+4 int
+4 string
+5 int
+5 string
diff --git a/Zend/tests/match/041.phpt b/Zend/tests/match/041.phpt
new file mode 100644
index 0000000000..1e22f1d688
--- /dev/null
+++ b/Zend/tests/match/041.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Match expression with trailing comma in condition list
+--FILE--
+<?php
+
+function print_bool($bool) {
+ echo match ($bool) {
+ false,
+ 0,
+ => "false\n",
+ true,
+ 1,
+ => "true\n",
+ default,
+ => "not bool\n",
+ };
+}
+
+print_bool(false);
+print_bool(0);
+print_bool(true);
+print_bool(1);
+print_bool(2);
+print_bool('foo');
+
+?>
+--EXPECT--
+false
+false
+true
+true
+not bool
+not bool
diff --git a/Zend/tests/match/042.phpt b/Zend/tests/match/042.phpt
new file mode 100644
index 0000000000..6ea30dd376
--- /dev/null
+++ b/Zend/tests/match/042.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Match expression with undefined variable as expression
+--FILE--
+<?php
+
+var_dump(match ($undefinedVariable) {
+ null => 'null',
+ default => 'default',
+});
+
+var_dump(match ($undefinedVariable) {
+ 1, 2, 3, 4, 5 => 'foo',
+ default => 'bar',
+});
+
+?>
+--EXPECTF--
+Warning: Undefined variable $undefinedVariable in %s.php on line 3
+string(4) "null"
+
+Warning: Undefined variable $undefinedVariable in %s.php on line 8
+string(3) "bar"
diff --git a/Zend/tests/method_argument_binding.phpt b/Zend/tests/method_argument_binding.phpt
index dea12621a3..6272003034 100644
--- a/Zend/tests/method_argument_binding.phpt
+++ b/Zend/tests/method_argument_binding.phpt
@@ -24,7 +24,7 @@ class C extends B {
(new C)->test();
class D {
- private final function method(&$x) {
+ private function method(&$x) {
++$x;
}
}
@@ -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/method_exists_002.phpt b/Zend/tests/method_exists_002.phpt
index 89d3f2824d..a777cd3c3b 100644
--- a/Zend/tests/method_exists_002.phpt
+++ b/Zend/tests/method_exists_002.phpt
@@ -4,37 +4,37 @@ Testing method_exists()
<?php
class bar {
- static public function stat_a2() {
- }
- static private function stat_b2() {
- }
- static protected function stat_c2() {
- }
+ static public function stat_a2() {
+ }
+ static private function stat_b2() {
+ }
+ static protected function stat_c2() {
+ }
- private function method_a() {
- }
- protected function method_b() {
- }
- public function method_c() {
- }
+ private function method_a() {
+ }
+ protected function method_b() {
+ }
+ public function method_c() {
+ }
}
class baz extends bar {
- static public function stat_a() {
- }
- static private function stat_b() {
- }
- static protected function stat_c() {
- }
+ static public function stat_a() {
+ }
+ static private function stat_b() {
+ }
+ static protected function stat_c() {
+ }
- private function method_a() {
- }
- protected function method_b() {
- }
- public function method_c() {
- }
+ private function method_a() {
+ }
+ protected function method_b() {
+ }
+ public function method_c() {
+ }
}
var_dump(method_exists('baz', 'stat_a'));
diff --git a/Zend/tests/method_static_var.phpt b/Zend/tests/method_static_var.phpt
index 438982bd71..06574732d7 100644
--- a/Zend/tests/method_static_var.phpt
+++ b/Zend/tests/method_static_var.phpt
@@ -1,30 +1,26 @@
--TEST--
Initial value of static var in method depends on the include time of the class definition
---XFAIL--
-Maybe not a bug
--FILE--
<?php
+
+/* The current behavior is probably a bug, but we should still test how it currently works. */
+
class Foo {
- public function __construct() {
- eval("class Bar extends Foo {}");
- }
- public static function test() {
- static $i = 0;
- var_dump(++$i);
- }
+ public static function test() {
+ static $i = 0;
+ var_dump(++$i);
+ }
}
-foo::test();
-new Foo;
-foo::test();
+Foo::test();
+eval("class Bar extends Foo {}");
+Foo::test();
-/**
- * function_add_ref() makes a clone of static variables for inherited functions, so $i in Bar::test gets initial value 1
- */
Bar::test();
Bar::test();
+?>
--EXPECT--
int(1)
int(2)
-int(1)
int(2)
+int(3)
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..c158cd1ca1 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(): Argument #1 ($function) must be a valid callback, first array member is not a valid class name or object
diff --git a/Zend/tests/methods-on-non-objects-catch.phpt b/Zend/tests/methods-on-non-objects-catch.phpt
index a52d3a722a..b090437084 100644
--- a/Zend/tests/methods-on-non-objects-catch.phpt
+++ b/Zend/tests/methods-on-non-objects-catch.phpt
@@ -8,7 +8,7 @@ set_error_handler(function($code, $message) {
$x= null;
try {
- var_dump($x->method());
+ var_dump($x->method());
} catch (Error $e) {
var_dump($e->getCode(), $e->getMessage());
}
diff --git a/Zend/tests/methods-on-non-objects-usort.phpt b/Zend/tests/methods-on-non-objects-usort.phpt
index ff4ad7451c..8a89023b7e 100644
--- a/Zend/tests/methods-on-non-objects-usort.phpt
+++ b/Zend/tests/methods-on-non-objects-usort.phpt
@@ -10,10 +10,10 @@ $comparator= null;
$list= [1, 4, 2, 3, -1];
usort($list, function($a, $b) use ($comparator) {
try {
- return $comparator->compare($a, $b);
+ return $comparator->compare($a, $b);
} catch (Error $e) {
- var_dump($e->getCode(), $e->getMessage());
- return 0;
+ var_dump($e->getCode(), $e->getMessage());
+ return 0;
}
});
var_dump($list);
diff --git a/Zend/tests/mod_001.phpt b/Zend/tests/mod_001.phpt
index 2c1ebc7cc2..5c543a2619 100644
--- a/Zend/tests/mod_001.phpt
+++ b/Zend/tests/mod_001.phpt
@@ -9,12 +9,12 @@ $b = array();
try {
$c = $a % $b;
var_dump($c);
-} catch (DivisionByZeroError $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+} catch (TypeError $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "Done\n";
?>
---EXPECT--
-Exception: Modulo by zero
+--EXPECTF--
+Exception: Unsupported operand types: array % array
Done
diff --git a/Zend/tests/mul_001.phpt b/Zend/tests/mul_001.phpt
index ea587902d0..ddb6576853 100644
--- a/Zend/tests/mul_001.phpt
+++ b/Zend/tests/mul_001.phpt
@@ -7,9 +7,9 @@ $a = array(1,2,3);
$b = array(1);
try {
- var_dump($a * $b);
+ var_dump($a * $b);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$c = $a * $b;
@@ -18,9 +18,9 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types
+Exception: Unsupported operand types: array * array
-Fatal error: Uncaught Error: Unsupported operand types in %s:%d
+Fatal error: Uncaught TypeError: Unsupported operand types: array * array in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/multibyte/bug68665.phpt b/Zend/tests/multibyte/bug68665.phpt
index 6846776570..a648a7f9af 100644
--- a/Zend/tests/multibyte/bug68665.phpt
+++ b/Zend/tests/multibyte/bug68665.phpt
@@ -2,9 +2,6 @@
Crash with Big5
--SKIPIF--
<?php
-if (!in_array("zend.detect_unicode", array_keys(ini_get_all()))) {
- die("skip Requires configure --enable-zend-multibyte option");
-}
if (!extension_loaded("mbstring")) {
die("skip Requires mbstring extension");
}
@@ -16,8 +13,5 @@ internal_encoding=big5
<?php
echo '\'hello';
?>
-
-===DONE===
--EXPECT--
'hello
-===DONE===
diff --git a/Zend/tests/multibyte/multibyte_encoding_001.phpt b/Zend/tests/multibyte/multibyte_encoding_001.phpt
index 1a094814ec..3b26dcb989 100644
--- a/Zend/tests/multibyte/multibyte_encoding_001.phpt
+++ b/Zend/tests/multibyte/multibyte_encoding_001.phpt
@@ -2,9 +2,6 @@
Zend Multibyte and ShiftJIS
--SKIPIF--
<?php
-if (!in_array("zend.detect_unicode", array_keys(ini_get_all()))) {
- die("skip Requires configure --enable-zend-multibyte option");
-}
if (!extension_loaded("mbstring")) {
die("skip Requires mbstring extension");
}
@@ -18,7 +15,5 @@ declare(encoding='Shift_JIS');
$s = "•\"; // 0x95+0x5c in script, not somewhere else "
printf("%x:%x\n", ord($s[0]), ord($s[1]));
?>
-===DONE===
--EXPECT--
95:5c
-===DONE===
diff --git a/Zend/tests/multibyte/multibyte_encoding_002.phpt b/Zend/tests/multibyte/multibyte_encoding_002.phpt
index 58ea015a6f..bf6107c541 100644
--- a/Zend/tests/multibyte/multibyte_encoding_002.phpt
+++ b/Zend/tests/multibyte/multibyte_encoding_002.phpt
@@ -2,9 +2,6 @@
Zend Multibyte and UTF-8 BOM
--SKIPIF--
<?php
-if (!in_array("zend.detect_unicode", array_keys(ini_get_all()))) {
- die("skip Requires configure --enable-zend-multibyte option");
-}
if (!extension_loaded("mbstring")) {
die("skip Requires mbstring extension");
}
@@ -16,7 +13,5 @@ internal_encoding=iso-8859-1
<?php
print "Hello World\n";
?>
-===DONE===
--EXPECT--
Hello World
-===DONE===
diff --git a/Zend/tests/multibyte/multibyte_encoding_003.phpt b/Zend/tests/multibyte/multibyte_encoding_003.phpt
index ee861dbcc4..a0983329f4 100644
--- a/Zend/tests/multibyte/multibyte_encoding_003.phpt
+++ b/Zend/tests/multibyte/multibyte_encoding_003.phpt
Binary files differ
diff --git a/Zend/tests/multibyte/multibyte_encoding_004.phpt b/Zend/tests/multibyte/multibyte_encoding_004.phpt
index 1b4f4fecef..124cd036de 100644
--- a/Zend/tests/multibyte/multibyte_encoding_004.phpt
+++ b/Zend/tests/multibyte/multibyte_encoding_004.phpt
@@ -2,9 +2,6 @@
test for mbstring script_encoding for flex unsafe encoding (Shift_JIS)
--SKIPIF--
<?php
-if (!in_array("zend.detect_unicode", array_keys(ini_get_all()))) {
- die("skip Requires configure --enable-zend-multibyte option");
-}
if (!extension_loaded("mbstring")) {
die("skip Requires mbstring extension");
}
@@ -15,12 +12,12 @@ zend.script_encoding=Shift_JIS
internal_encoding=Shift_JIS
--FILE--
<?php
- function —\Ž\”\($ˆø”)
- {
- echo $ˆø”;
- }
+ function —\Ž\”\($ˆø”)
+ {
+ echo $ˆø”;
+ }
- —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\");
+ —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\");
?>
--EXPECT--
ƒhƒŒƒ~ƒtƒ@ƒ\
diff --git a/Zend/tests/multibyte/multibyte_encoding_005.phpt b/Zend/tests/multibyte/multibyte_encoding_005.phpt
index 305175d0cc..993e078b21 100644
--- a/Zend/tests/multibyte/multibyte_encoding_005.phpt
+++ b/Zend/tests/multibyte/multibyte_encoding_005.phpt
@@ -2,9 +2,6 @@
encoding conversion from script encoding into internal encoding
--SKIPIF--
<?php
-if (!in_array("zend.detect_unicode", array_keys(ini_get_all()))) {
- die("skip Requires configure --enable-zend-multibyte option");
-}
if (!extension_loaded("mbstring")) {
die("skip Requires mbstring extension");
}
@@ -16,12 +13,12 @@ zend.script_encoding=Shift_JIS
internal_encoding=UTF-8
--FILE--
<?php
- function —\Ž\”\($ˆø”)
- {
- echo $ˆø”;
- }
+ function —\Ž\”\($ˆø”)
+ {
+ echo $ˆø”;
+ }
- —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\");
+ —\Ž\”\("ƒhƒŒƒ~ƒtƒ@ƒ\");
?>
--EXPECT--
ドレミファソ
diff --git a/Zend/tests/multibyte/multibyte_encoding_006.phpt b/Zend/tests/multibyte/multibyte_encoding_006.phpt
index d518c29e3e..4d6292ae37 100644
--- a/Zend/tests/multibyte/multibyte_encoding_006.phpt
+++ b/Zend/tests/multibyte/multibyte_encoding_006.phpt
Binary files differ
diff --git a/Zend/tests/name_collision_07.phpt b/Zend/tests/name_collision_07.phpt
index bc596a3549..cb35e88db6 100644
--- a/Zend/tests/name_collision_07.phpt
+++ b/Zend/tests/name_collision_07.phpt
@@ -11,5 +11,6 @@ namespace Bazzle {
use Foo\Bar;
class Bar {}
}
+?>
--EXPECTF--
Fatal error: Cannot declare class Bazzle\Bar because the name is already in use in %s on line %d
diff --git a/Zend/tests/name_collision_08.phpt b/Zend/tests/name_collision_08.phpt
index d897419102..652fa3dbf1 100644
--- a/Zend/tests/name_collision_08.phpt
+++ b/Zend/tests/name_collision_08.phpt
@@ -11,5 +11,6 @@ namespace Bazzle {
use function Foo\bar;
function bar() {}
}
+?>
--EXPECTF--
Fatal error: Cannot declare function Bazzle\bar because the name is already in use in %s on line %d
diff --git a/Zend/tests/name_collision_09.phpt b/Zend/tests/name_collision_09.phpt
index b46459eef6..88d4d55fc8 100644
--- a/Zend/tests/name_collision_09.phpt
+++ b/Zend/tests/name_collision_09.phpt
@@ -11,5 +11,6 @@ namespace Bazzle {
use const Foo\BAR;
const BAR = 24;
}
+?>
--EXPECTF--
Fatal error: Cannot declare const Bazzle\BAR because the name is already in use in %s on line %d
diff --git a/Zend/tests/named_params/__call.phpt b/Zend/tests/named_params/__call.phpt
new file mode 100644
index 0000000000..a5ebdc2338
--- /dev/null
+++ b/Zend/tests/named_params/__call.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Check that __call() and __callStatic() work with named parameters
+--FILE--
+<?php
+
+class Test {
+ public function __call(string $method, array $args) {
+ $this->{'_'.$method}(...$args);
+ }
+
+ public static function __callStatic(string $method, array $args) {
+ (new static)->{'_'.$method}(...$args);
+ }
+
+ private function _method($a = 'a', $b = 'b') {
+ echo "a: $a, b: $b\n";
+ }
+}
+
+$obj = new class { public function __toString() { return "STR"; } };
+
+$test = new Test;
+$test->method(a: 'A', b: 'B');
+$test->method(b: 'B');
+$test->method(b: $obj);
+Test::method(a: 'A', b: 'B');
+Test::method(b: 'B');
+Test::method(b: $obj);
+
+?>
+--EXPECT--
+a: A, b: B
+a: a, b: B
+a: a, b: STR
+a: A, b: B
+a: a, b: B
+a: a, b: STR
diff --git a/Zend/tests/named_params/__invoke.phpt b/Zend/tests/named_params/__invoke.phpt
new file mode 100644
index 0000000000..6ebbac0f07
--- /dev/null
+++ b/Zend/tests/named_params/__invoke.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Check that __invoke() works with named parameters
+--FILE--
+<?php
+
+class Test {
+ public function __invoke($a = 'a', $b = 'b') {
+ echo "a: $a, b: $b\n";
+ }
+}
+
+class Test2 {
+ public function __invoke($a = 'a', $b = 'b', ...$rest) {
+ echo "a: $a, b: $b\n";
+ var_dump($rest);
+ }
+}
+
+$test = new Test;
+$test(b: 'B', a: 'A');
+$test(b: 'B');
+try {
+ $test(b: 'B', c: 'C');
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+echo "\n";
+
+$test2 = new Test2;
+$test2(b: 'B', a: 'A', c: 'C');
+$test2(b: 'B', c: 'C');
+echo "\n";
+
+$test3 = function($a = 'a', $b = 'b') {
+ echo "a: $a, b: $b\n";
+};
+$test3(b: 'B', a: 'A');
+$test3(b: 'B');
+try {
+ $test3(b: 'B', c: 'C');
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+a: A, b: B
+a: a, b: B
+Unknown named parameter $c
+
+a: A, b: B
+array(1) {
+ ["c"]=>
+ string(1) "C"
+}
+a: a, b: B
+array(1) {
+ ["c"]=>
+ string(1) "C"
+}
+
+a: A, b: B
+a: a, b: B
+Unknown named parameter $c
diff --git a/Zend/tests/named_params/assert.phpt b/Zend/tests/named_params/assert.phpt
new file mode 100644
index 0000000000..40a92a2f1f
--- /dev/null
+++ b/Zend/tests/named_params/assert.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Calling assert with named params
+--FILE--
+<?php
+
+assert(assertion: true);
+try {
+ assert(assertion: false);
+} catch (AssertionError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+assert(assertion: true, description: "Description");
+try {
+ assert(assertion: false, description: "Description");
+} catch (AssertionError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ assert(description: "Description");
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+assert(assertion: false)
+Description
+Named parameter $description overwrites previous argument
diff --git a/Zend/tests/named_params/attributes.phpt b/Zend/tests/named_params/attributes.phpt
new file mode 100644
index 0000000000..94d2fad19f
--- /dev/null
+++ b/Zend/tests/named_params/attributes.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Named params in attributes
+--FILE--
+<?php
+
+#[Attribute]
+class MyAttribute {
+ public function __construct(
+ public $a = 'a',
+ public $b = 'b',
+ public $c = 'c',
+ ) {}
+}
+
+#[MyAttribute('A', c: 'C')]
+class Test1 {}
+
+#[MyAttribute('A', a: 'C')]
+class Test2 {}
+
+$attr = (new ReflectionClass(Test1::class))->getAttributes()[0];
+var_dump($attr->getName());
+var_dump($attr->getArguments());
+var_dump($attr->newInstance());
+
+$attr = (new ReflectionClass(Test2::class))->getAttributes()[0];
+try {
+ var_dump($attr->newInstance());
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+string(11) "MyAttribute"
+array(2) {
+ [0]=>
+ string(1) "A"
+ ["c"]=>
+ string(1) "C"
+}
+object(MyAttribute)#1 (3) {
+ ["a"]=>
+ string(1) "A"
+ ["b"]=>
+ string(1) "b"
+ ["c"]=>
+ string(1) "C"
+}
+Named parameter $a overwrites previous argument
diff --git a/Zend/tests/named_params/attributes_duplicate_named_param.phpt b/Zend/tests/named_params/attributes_duplicate_named_param.phpt
new file mode 100644
index 0000000000..3c4203a6c7
--- /dev/null
+++ b/Zend/tests/named_params/attributes_duplicate_named_param.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Named params in attributes: Duplicate named parameter error
+--FILE--
+<?php
+
+#[MyAttribute(a: 'A', a: 'A')]
+class Test {}
+
+?>
+--EXPECTF--
+Fatal error: Duplicate named parameter $a in %s on line %d
diff --git a/Zend/tests/named_params/attributes_named_flags.phpt b/Zend/tests/named_params/attributes_named_flags.phpt
new file mode 100644
index 0000000000..fcb08755e3
--- /dev/null
+++ b/Zend/tests/named_params/attributes_named_flags.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Named flags parameter for Attribute attribute
+--FILE--
+<?php
+
+#[Attribute(flags: Attribute::TARGET_CLASS)]
+class MyAttribute {
+}
+
+#[MyAttribute]
+function test() {}
+
+(new ReflectionFunction('test'))->getAttributes()[0]->newInstance();
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Attribute "MyAttribute" cannot target function (allowed targets: class) in %s:%d
+Stack trace:
+#0 %s(%d): ReflectionAttribute->newInstance()
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/named_params/attributes_named_flags_incorrect.phpt b/Zend/tests/named_params/attributes_named_flags_incorrect.phpt
new file mode 100644
index 0000000000..2ad231602f
--- /dev/null
+++ b/Zend/tests/named_params/attributes_named_flags_incorrect.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Named flags parameter for Attribute attribute (incorrect parameter name)
+--FILE--
+<?php
+
+// TODO: This should error at compile-time.
+#[Attribute(not_flags: Attribute::TARGET_CLASS)]
+class MyAttribute {
+}
+
+#[MyAttribute]
+function test() {}
+
+(new ReflectionFunction('test'))->getAttributes()[0]->newInstance();
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Attribute "MyAttribute" cannot target function (allowed targets: class) in %s:%d
+Stack trace:
+#0 %s(%d): ReflectionAttribute->newInstance()
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/named_params/attributes_positional_after_named.phpt b/Zend/tests/named_params/attributes_positional_after_named.phpt
new file mode 100644
index 0000000000..2301635b68
--- /dev/null
+++ b/Zend/tests/named_params/attributes_positional_after_named.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Named params in attributes: Positional after named error
+--FILE--
+<?php
+
+#[Attribute]
+class MyAttribute { }
+
+#[MyAttribute(a: 'A', 'B')]
+class Test {}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use positional argument after named argument in %s on line %d
diff --git a/Zend/tests/named_params/backtrace.phpt b/Zend/tests/named_params/backtrace.phpt
new file mode 100644
index 0000000000..1ccae8503d
--- /dev/null
+++ b/Zend/tests/named_params/backtrace.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Extra named params in backtraces
+--FILE--
+<?php
+
+function test($a, ...$rest) {
+ var_dump(debug_backtrace());
+ debug_print_backtrace();
+ throw new Exception("Test");
+}
+
+try {
+ test(1, 2, x: 3, y: 4);
+} catch (Exception $e) {
+ var_dump($e->getTrace());
+ echo $e, "\n";
+}
+
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ array(4) {
+ ["file"]=>
+ string(%d) "%s"
+ ["line"]=>
+ int(10)
+ ["function"]=>
+ string(4) "test"
+ ["args"]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ ["x"]=>
+ int(3)
+ ["y"]=>
+ int(4)
+ }
+ }
+}
+#0 test(1, 2, x: 3, y: 4) called at [%s:10]
+array(1) {
+ [0]=>
+ array(4) {
+ ["file"]=>
+ string(%d) "%s"
+ ["line"]=>
+ int(10)
+ ["function"]=>
+ string(4) "test"
+ ["args"]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ ["x"]=>
+ int(3)
+ ["y"]=>
+ int(4)
+ }
+ }
+}
+Exception: Test in %s:%d
+Stack trace:
+#0 %s(%d): test(1, 2, x: 3, y: 4)
+#1 {main}
diff --git a/Zend/tests/named_params/basic.phpt b/Zend/tests/named_params/basic.phpt
new file mode 100644
index 0000000000..4ad187d255
--- /dev/null
+++ b/Zend/tests/named_params/basic.phpt
@@ -0,0 +1,106 @@
+--TEST--
+Basic test
+--FILE--
+<?php
+
+function test($a, $b, $c = "c", $d = "d", $e = "e") {
+ echo "a=$a, b=$b, c=$c, d=$d, e=$e\n";
+}
+
+function test3(&$a, &$b, &$c = "c", &$d = "d", &$e = "e") {
+ echo "a=$a, b=$b, c=$c, d=$d, e=$e\n";
+}
+
+function &id($x) {
+ return $x;
+}
+
+$a = "A"; $b = "B"; $c = "C"; $d = "D"; $e = "E";
+
+echo "SEND_VAL:\n";
+test("A", "B", "C", d: "D", e: "E");
+test("A", "B", "C", e: "E", d: "D");
+test(e: "E", a: "A", d: "D", b: "B", c: "C");
+test("A", "B", "C", e: "E");
+
+echo "SEND_VAL_EX:\n";
+test2("A", "B", "C", d: "D", e: "E");
+test2("A", "B", "C", e: "E", d: "D");
+test2(e: "E", a: "A", d: "D", b: "B", c: "C");
+test2("A", "B", "C", e: "E");
+
+echo "SEND_VAR:\n";
+test($a, $b, $c, d: $d, e: $e);
+test($a, $b, $c, e: $e, d: $d);
+test(e: $e, a: $a, d: $d, b: $b, c: $c);
+test(a: $a, b: $b, c: $c, e: $e);
+
+echo "SEND_VAR_EX:\n";
+test2($a, $b, $c, d: $d, e: $e);
+test2($a, $b, $c, e: $e, d: $d);
+test2(e: $e, a: $a, d: $d, b: $b, c: $c);
+test2(a: $a, b: $b, c: $c, e: $e);
+
+echo "SEND_VAR_NO_REF:\n";
+test3(id("A"), id("B"), id("C"), d: id("D"), e: id("E"));
+test3(id("A"), id("B"), id("C"), e: id("E"), d: id("D"));
+test3(e: id("E"), a: id("A"), d: id("D"), b: id("B"), c: id("C"));
+test3(id("A"), id("B"), id("C"), e: id("E"));
+
+echo "SEND_VAR_NO_REF_EX:\n";
+test4(id("A"), id("B"), id("C"), d: id("D"), e: id("E"));
+test4(id("A"), id("B"), id("C"), e: id("E"), d: id("D"));
+test4(e: id("E"), a: id("A"), d: id("D"), b: id("B"), c: id("C"));
+test4(id("A"), id("B"), id("C"), e: id("E"));
+
+echo "SEND_REF:\n";
+test3($a, $b, $c, d: $d, e: $e);
+test3($a, $b, $c, e: $e, d: $d);
+test3(e: $e, a: $a, d: $d, b: $b, c: $c);
+test3(a: $a, b: $b, c: $c, e: $e);
+
+function test2($a, $b, $c = "c", $d = "d", $e = "e") {
+ echo "a=$a, b=$b, c=$c, d=$d, e=$e\n";
+}
+
+function test4(&$a, &$b, &$c = "c", &$d = "d", &$e = "e") {
+ echo "a=$a, b=$b, c=$c, d=$d, e=$e\n";
+}
+
+?>
+--EXPECT--
+SEND_VAL:
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=d, e=E
+SEND_VAL_EX:
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=d, e=E
+SEND_VAR:
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=d, e=E
+SEND_VAR_EX:
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=d, e=E
+SEND_VAR_NO_REF:
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=d, e=E
+SEND_VAR_NO_REF_EX:
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=d, e=E
+SEND_REF:
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=D, e=E
+a=A, b=B, c=C, d=d, e=E
diff --git a/Zend/tests/named_params/call_user_func.phpt b/Zend/tests/named_params/call_user_func.phpt
new file mode 100644
index 0000000000..2e6f9257db
--- /dev/null
+++ b/Zend/tests/named_params/call_user_func.phpt
@@ -0,0 +1,114 @@
+--TEST--
+call_user_func() and friends with named parameters
+--FILE--
+<?php
+
+$test = function($a = 'a', $b = 'b', $c = 'c') {
+ echo "a = $a, b = $b, c = $c\n";
+};
+$test_variadic = function(...$args) {
+ var_dump($args);
+};
+$test_ref = function(&$ref) {
+ $ref++;
+};
+$test_required = function($a, $b) {
+ echo "a = $a, b = $b\n";
+};
+
+class Test {
+ public function __construct($a = 'a', $b = 'b', $c = 'c') {
+ if (func_num_args() != 0) {
+ echo "a = $a, b = $b, c = $c\n";
+ }
+ }
+
+ public function method($a = 'a', $b = 'b', $c = 'c') {
+ echo "a = $a, b = $b, c = $c\n";
+ }
+}
+
+call_user_func($test, 'A', c: 'C');
+call_user_func($test, c: 'C', a: 'A');
+call_user_func($test, c: 'C');
+call_user_func($test_variadic, 'A', c: 'C');
+call_user_func($test_ref, ref: null);
+var_dump(call_user_func('call_user_func', $test, c: 'D'));
+try {
+ call_user_func($test_required, b: 'B');
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(call_user_func('array_slice', [1, 2, 3, 4, 5], length: 2));
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(call_user_func('array_slice', [1, 2, 3, 4, 'x' => 5], 3, preserve_keys: true));
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+echo "\n";
+
+$test->__invoke('A', c: 'C');
+$test_variadic->__invoke('A', c: 'C');
+$test->call(new class {}, 'A', c: 'C');
+$test_variadic->call(new class {}, 'A', c: 'C');
+echo "\n";
+
+$rf = new ReflectionFunction($test);
+$rf->invoke('A', c: 'C');
+$rf->invokeArgs(['A', 'c' => 'C']);
+$rm = new ReflectionMethod(Test::class, 'method');
+$rm->invoke(new Test, 'A', c: 'C');
+$rm->invokeArgs(new Test, ['A', 'c' => 'C']);
+$rc = new ReflectionClass(Test::class);
+$rc->newInstance('A', c: 'C');
+$rc->newInstanceArgs(['A', 'c' => 'C']);
+
+?>
+--EXPECTF--
+a = A, b = b, c = C
+a = A, b = b, c = C
+a = a, b = b, c = C
+array(2) {
+ [0]=>
+ string(1) "A"
+ ["c"]=>
+ string(1) "C"
+}
+
+Warning: {closure}(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d
+a = a, b = b, c = D
+NULL
+{closure}(): Argument #1 ($a) not passed
+array_slice(): Argument #2 ($offset) not passed
+array(2) {
+ [3]=>
+ int(4)
+ ["x"]=>
+ int(5)
+}
+
+a = A, b = b, c = C
+array(2) {
+ [0]=>
+ string(1) "A"
+ ["c"]=>
+ string(1) "C"
+}
+a = A, b = b, c = C
+array(2) {
+ [0]=>
+ string(1) "A"
+ ["c"]=>
+ string(1) "C"
+}
+
+a = A, b = b, c = C
+a = A, b = b, c = C
+a = A, b = b, c = C
+a = A, b = b, c = C
+a = A, b = b, c = C
+a = A, b = b, c = C
diff --git a/Zend/tests/named_params/call_user_func_array.phpt b/Zend/tests/named_params/call_user_func_array.phpt
new file mode 100644
index 0000000000..ebee06ea6a
--- /dev/null
+++ b/Zend/tests/named_params/call_user_func_array.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Behavior of call_user_func_array() with named parameters
+--FILE--
+<?php
+
+namespace {
+ $test = function($a = 'a', $b = 'b', $c = 'c') {
+ echo "a = $a, b = $b, c = $c\n";
+ };
+ $test_variadic = function(...$args) {
+ var_dump($args);
+ };
+
+ call_user_func_array($test, ['A', 'B']);
+ call_user_func_array($test, [1 => 'A', 0 => 'B']);
+ call_user_func_array($test, ['A', 'c' => 'C']);
+ call_user_func_array($test_variadic, ['A', 'c' => 'C']);
+ try {
+ call_user_func_array($test, ['d' => 'D']);
+ } catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ call_user_func_array($test, ['c' => 'C', 'A']);
+ } catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+}
+
+namespace Foo {
+ call_user_func_array($test, ['A', 'B']);
+ call_user_func_array($test, [1 => 'A', 0 => 'B']);
+ call_user_func_array($test, ['A', 'c' => 'C']);
+ call_user_func_array($test_variadic, ['A', 'c' => 'C']);
+ try {
+ call_user_func_array($test, ['d' => 'D']);
+ } catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ call_user_func_array($test, ['c' => 'C', 'A']);
+ } catch (\Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+}
+
+?>
+--EXPECT--
+a = A, b = B, c = c
+a = A, b = B, c = c
+a = A, b = b, c = C
+array(2) {
+ [0]=>
+ string(1) "A"
+ ["c"]=>
+ string(1) "C"
+}
+Unknown named parameter $d
+Cannot use positional argument after named argument
+
+a = A, b = B, c = c
+a = A, b = B, c = c
+a = A, b = b, c = C
+array(2) {
+ [0]=>
+ string(1) "A"
+ ["c"]=>
+ string(1) "C"
+}
+Unknown named parameter $d
+Cannot use positional argument after named argument
diff --git a/Zend/tests/named_params/cannot_pass_by_ref.phpt b/Zend/tests/named_params/cannot_pass_by_ref.phpt
new file mode 100644
index 0000000000..20080f9e64
--- /dev/null
+++ b/Zend/tests/named_params/cannot_pass_by_ref.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Cannot pass by reference error with named parameters
+--FILE--
+<?php
+function test($a, &$e) {}
+try {
+ test(e: 42);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+test(): Argument #2 ($e) cannot be passed by reference
diff --git a/Zend/tests/named_params/ctor_extra_named_args.phpt b/Zend/tests/named_params/ctor_extra_named_args.phpt
new file mode 100644
index 0000000000..ae569ea65d
--- /dev/null
+++ b/Zend/tests/named_params/ctor_extra_named_args.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Passing unknown named args to a non-existing ctor
+--FILE--
+<?php
+
+class Test {}
+
+try {
+ new stdClass(x: "nope");
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ new Test(x: "nope");
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Unknown named parameter $x
+Unknown named parameter $x
diff --git a/Zend/tests/named_params/defaults.phpt b/Zend/tests/named_params/defaults.phpt
new file mode 100644
index 0000000000..23f2cab92d
--- /dev/null
+++ b/Zend/tests/named_params/defaults.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Skipping over default parameters
+--FILE--
+<?php
+
+function test1($a = 'a', $b = 'b') {
+ echo "a: $a, b: $b\n";
+}
+
+function test2($a = SOME_CONST, $b = 'b') {
+ echo "a: $a, b: $b\n";
+}
+
+function test3($a = SOME_OTHER_CONST, $b = 'b') {
+ echo "a: $a, b: $b\n";
+}
+
+test1(b: 'B');
+
+define('SOME_CONST', 'X');
+test2(b: 'B');
+
+// NB: We also want to test the stack trace.
+test3(b: 'B');
+
+?>
+--EXPECTF--
+a: a, b: B
+a: X, b: B
+
+Fatal error: Uncaught Error: Undefined constant "SOME_OTHER_CONST" in %s:%d
+Stack trace:
+#0 %s(%d): test3(NULL, 'B')
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/named_params/duplicate_param.phpt b/Zend/tests/named_params/duplicate_param.phpt
new file mode 100644
index 0000000000..6abc95bba0
--- /dev/null
+++ b/Zend/tests/named_params/duplicate_param.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Duplicate param
+--FILE--
+<?php
+
+function test($a) {}
+
+try {
+ test(a: 1, a: 2);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ test(1, a: 2);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Named parameter $a overwrites previous argument
+Named parameter $a overwrites previous argument
diff --git a/Zend/tests/named_params/func_get_args.phpt b/Zend/tests/named_params/func_get_args.phpt
new file mode 100644
index 0000000000..a33f45229d
--- /dev/null
+++ b/Zend/tests/named_params/func_get_args.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Behavior of func_get_args() and friends with named parameters
+--FILE--
+<?php
+
+function test($a, $b = 'b', $c = 'c') {
+ var_dump(func_num_args());
+ var_dump(func_get_args());
+ var_dump(func_get_arg(0));
+ var_dump(func_get_arg(1));
+ var_dump(func_get_arg(2));
+}
+
+test(c: 'C', a: 'A');
+
+?>
+--EXPECT--
+int(3)
+array(3) {
+ [0]=>
+ string(1) "A"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "C"
+}
+string(1) "A"
+string(1) "b"
+string(1) "C"
diff --git a/Zend/tests/named_params/internal.phpt b/Zend/tests/named_params/internal.phpt
new file mode 100644
index 0000000000..d9fef27c93
--- /dev/null
+++ b/Zend/tests/named_params/internal.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Named params on internal functions
+--FILE--
+<?php
+
+var_dump(array_slice(array: [1, 2, 3, 4, 5], offset: 2, length: 2));
+var_dump(array_slice(length: 2, offset: 2, array: [1, 2, 3, 4, 5]));
+
+var_dump(array_slice(array: ['a' => 0, 'b' => 1], offset: 1, preserve_keys: true));
+var_dump(array_slice(['a' => 0, 'b' => 1], preserve_keys: true, offset: 1));
+var_dump(str_pad("foo", 6, pad_type: STR_PAD_LEFT));
+
+// Named params work with specialized functions.
+var_dump(strlen(string: 'foo'));
+
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(4)
+}
+array(1) {
+ ["b"]=>
+ int(1)
+}
+array(1) {
+ ["b"]=>
+ int(1)
+}
+string(6) " foo"
+int(3)
diff --git a/Zend/tests/named_params/internal_variadics.phpt b/Zend/tests/named_params/internal_variadics.phpt
new file mode 100644
index 0000000000..3599f644ac
--- /dev/null
+++ b/Zend/tests/named_params/internal_variadics.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Named params on internal functions: Variadic functions that don't support extra named args
+--FILE--
+<?php
+
+try {
+ array_merge([1, 2], a: [3, 4]);
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ array_diff_key([1, 2], [3, 4], a: [5, 6]);
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+array_merge() does not accept unknown named parameters
+array_diff_key() does not accept unknown named parameters
diff --git a/Zend/tests/named_params/missing_param.phpt b/Zend/tests/named_params/missing_param.phpt
new file mode 100644
index 0000000000..f8b0b356ce
--- /dev/null
+++ b/Zend/tests/named_params/missing_param.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Required parameter not passed
+--FILE--
+<?php
+
+function test($a, $b, $c, $d) {
+}
+
+try {
+ test(a: 'a', d: 'd');
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ array_keys(strict: true);
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ array_keys([], strict: true);
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+// This works fine, as search_value is explicitly specified.
+var_dump(array_keys([41, 42], filter_value: 42, strict: true));
+
+?>
+--EXPECT--
+test(): Argument #2 ($b) not passed
+array_keys(): Argument #1 ($array) not passed
+array_keys(): Argument #2 ($filter_value) must be passed explicitly, because the default value is not known
+array(1) {
+ [0]=>
+ int(1)
+}
diff --git a/Zend/tests/named_params/positional_after_named.phpt b/Zend/tests/named_params/positional_after_named.phpt
new file mode 100644
index 0000000000..a415df55ec
--- /dev/null
+++ b/Zend/tests/named_params/positional_after_named.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot used positional parameter after named parameter
+--FILE--
+<?php
+
+test(a: 1, 2);
+
+?>
+--EXPECTF--
+Fatal error: Cannot use positional argument after named argument in %s on line %d
diff --git a/Zend/tests/named_params/references.phpt b/Zend/tests/named_params/references.phpt
new file mode 100644
index 0000000000..aa3689b5e0
--- /dev/null
+++ b/Zend/tests/named_params/references.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Check that reference detection works properly
+--FILE--
+<?php
+
+$v00 = $v01 = $v32 = $v33 = 0;
+test(p32: $v32, p33: $v33, p00: $v00, p01: $v01);
+echo "$v00 $v01 $v32 $v33\n";
+
+$v = [0 => 0, 1 => 0, 32 => 0, 33 => 0];
+test(p32: $v[32], p33: $v[33], p00: $v[0], p01: $v[1]);
+echo "$v[0] $v[1] $v[32] $v[33]\n";
+
+function test(
+ &$p00 = null, $p01 = null, &$p02 = null, $p03 = null, &$p04 = null, $p05 = null,
+ &$p06 = null, $p07 = null, &$p08 = null, $p09 = null, &$p10 = null, $p11 = null,
+ &$p12 = null, $p13 = null, &$p14 = null, $p15 = null, &$p16 = null, $p17 = null,
+ &$p18 = null, $p19 = null, &$p20 = null, $p21 = null, &$p22 = null, $p23 = null,
+ &$p24 = null, $p25 = null, &$p26 = null, $p27 = null, &$p28 = null, $p29 = null,
+ &$p30 = null, $p31 = null, &$p32 = null, $p33 = null, &$p34 = null, $p35 = null
+) {
+ $p00++;
+ $p32++;
+}
+
+$v00 = $v01 = $v32 = $v33 = 0;
+test(p32: $v32, p33: $v33, p00: $v00, p01: $v01);
+echo "$v00 $v01 $v32 $v33\n";
+
+$v = [0 => 0, 1 => 0, 32 => 0, 33 => 0];
+test(p32: $v[32], p33: $v[33], p00: $v[0], p01: $v[1]);
+echo "$v[0] $v[1] $v[32] $v[33]\n";
+
+?>
+--EXPECT--
+1 0 1 0
+1 0 1 0
+1 0 1 0
+1 0 1 0
diff --git a/Zend/tests/named_params/reserved.phpt b/Zend/tests/named_params/reserved.phpt
new file mode 100644
index 0000000000..93ae470569
--- /dev/null
+++ b/Zend/tests/named_params/reserved.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Reserved keywords can be used with named parameters
+--FILE--
+<?php
+
+function test($array) {
+ var_dump($array);
+}
+
+test(array: []);
+
+?>
+--EXPECT--
+array(0) {
+}
diff --git a/Zend/tests/named_params/runtime_cache_init.phpt b/Zend/tests/named_params/runtime_cache_init.phpt
new file mode 100644
index 0000000000..e55db1a72d
--- /dev/null
+++ b/Zend/tests/named_params/runtime_cache_init.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Uninitialized run-time cache when resolving default values
+--FILE--
+<?php
+
+class Test {
+ public static function method($a = FOO, $b = 1) {
+ echo "a = $a, b = $b\n";
+ }
+}
+
+define('FOO', 42);
+call_user_func(['Test', 'method'], b: 0);
+
+?>
+--EXPECT--
+a = 42, b = 0
diff --git a/Zend/tests/named_params/undef_var.phpt b/Zend/tests/named_params/undef_var.phpt
new file mode 100644
index 0000000000..b1d5682434
--- /dev/null
+++ b/Zend/tests/named_params/undef_var.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Passing undefined variabled to named arg
+--FILE--
+<?php
+
+function func1($arg) { var_dump($arg); }
+func1(arg: $undef);
+func2(arg: $undef);
+function func2($arg) { var_dump($arg); }
+
+?>
+--EXPECTF--
+Warning: Undefined variable $undef in %s on line %d
+NULL
+
+Warning: Undefined variable $undef in %s on line %d
+NULL
diff --git a/Zend/tests/named_params/unknown_named_param.phpt b/Zend/tests/named_params/unknown_named_param.phpt
new file mode 100644
index 0000000000..5a18932ffd
--- /dev/null
+++ b/Zend/tests/named_params/unknown_named_param.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Unknown named parameter
+--FILE--
+<?php
+
+function test($a) {
+}
+
+function test2(...$a) {
+}
+
+try {
+ test(b: 42);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ test(b: new stdClass);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ test(b: 2, a: 1);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ test(...new ArrayIterator(['unknown' => 42]));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ test2(a: 42);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Unknown named parameter $b
+Unknown named parameter $b
+Unknown named parameter $b
+Unknown named parameter $unknown
diff --git a/Zend/tests/named_params/unpack.phpt b/Zend/tests/named_params/unpack.phpt
new file mode 100644
index 0000000000..92bb4792c3
--- /dev/null
+++ b/Zend/tests/named_params/unpack.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Unpacking named parameters
+--FILE--
+<?php
+
+function test($a, $b, $c) {
+ echo "a = $a, b = $b, c = $c\n";
+}
+
+function test2($a = null, &$b = null) {
+ $b++;
+}
+
+test(...['a' => 'a', 'b' => 'b', 'c' => 'c']);
+test(...['c' => 'c', 'b' => 'b', 'a' => 'a']);
+test(...['a', 'b' => 'b', 'c' => 'c']);
+
+try {
+ test(...['a', 'b' => 'b', 'c']);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ test(...['a', 'a' => 'a']);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+$ary = ['b' => 0];
+$ary2 = $ary;
+test2(...$ary);
+var_dump($ary, $ary2);
+
+test(...new ArrayIterator(['a' => 'a', 'b' => 'b', 'c' => 'c']));
+test(...new ArrayIterator(['c' => 'c', 'b' => 'b', 'a' => 'a']));
+test(...new ArrayIterator(['a', 'b' => 'b', 'c' => 'c']));
+
+try {
+ test(...new ArrayIterator(['a', 'b' => 'b', 'c']));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ test(...new ArrayIterator(['a', 'a' => 'a']));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+$ary = ['b' => 0];
+$ary2 = $ary;
+test2(...new ArrayIterator($ary));
+var_dump($ary, $ary2);
+
+?>
+--EXPECTF--
+a = a, b = b, c = c
+a = a, b = b, c = c
+a = a, b = b, c = c
+Cannot use positional argument after named argument during unpacking
+Named parameter $a overwrites previous argument
+array(1) {
+ ["b"]=>
+ int(1)
+}
+array(1) {
+ ["b"]=>
+ int(0)
+}
+a = a, b = b, c = c
+a = a, b = b, c = c
+a = a, b = b, c = c
+Cannot use positional argument after named argument during unpacking
+Named parameter $a overwrites previous argument
+
+Warning: Cannot pass by-reference argument 2 of test2() by unpacking a Traversable, passing by-value instead in %s on line %d
+array(1) {
+ ["b"]=>
+ int(0)
+}
+array(1) {
+ ["b"]=>
+ int(0)
+}
diff --git a/Zend/tests/named_params/unpack_and_named_1.phpt b/Zend/tests/named_params/unpack_and_named_1.phpt
new file mode 100644
index 0000000000..24d448dc8b
--- /dev/null
+++ b/Zend/tests/named_params/unpack_and_named_1.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Mixing unpacking and named params (1)
+--FILE--
+<?php
+
+test(...[], a: 42);
+
+?>
+--EXPECTF--
+Fatal error: Cannot combine named arguments and argument unpacking in %s on line %d
diff --git a/Zend/tests/named_params/unpack_and_named_2.phpt b/Zend/tests/named_params/unpack_and_named_2.phpt
new file mode 100644
index 0000000000..2035b2e2dd
--- /dev/null
+++ b/Zend/tests/named_params/unpack_and_named_2.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Mixing unpacking and named params (2)
+--FILE--
+<?php
+
+test(a: 42, ...[]);
+
+?>
+--EXPECTF--
+Fatal error: Cannot combine named arguments and argument unpacking in %s on line %d
diff --git a/Zend/tests/named_params/variadic.phpt b/Zend/tests/named_params/variadic.phpt
new file mode 100644
index 0000000000..212a4569fb
--- /dev/null
+++ b/Zend/tests/named_params/variadic.phpt
@@ -0,0 +1,66 @@
+--TEST--
+Additional named params are collect into variadics
+--FILE--
+<?php
+
+function test($a, string ...$extra) {
+ var_dump($a);
+ var_dump($extra);
+ // Extra named parameters do not contribute toward func_num_args() and func_get_args().
+ var_dump(func_num_args());
+ var_dump(func_get_args());
+}
+
+function test2(&...$refs) {
+ foreach ($refs as &$ref) $ref++;
+}
+
+test(b: 'b', a: 'a', c: 'c', extra: 'extra');
+echo "\n";
+
+test('a', 'b', 'c', d: 'd');
+echo "\n";
+
+$x = 0;
+$y = 0;
+test2(x: $x, y: $y);
+var_dump($x, $y);
+
+?>
+--EXPECT--
+string(1) "a"
+array(3) {
+ ["b"]=>
+ string(1) "b"
+ ["c"]=>
+ string(1) "c"
+ ["extra"]=>
+ string(5) "extra"
+}
+int(1)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+
+string(1) "a"
+array(3) {
+ [0]=>
+ string(1) "b"
+ [1]=>
+ string(1) "c"
+ ["d"]=>
+ string(1) "d"
+}
+int(3)
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+
+int(1)
+int(1)
diff --git a/Zend/tests/namespace_first_stmt_nop.phpt b/Zend/tests/namespace_first_stmt_nop.phpt
new file mode 100644
index 0000000000..8f26fdc859
--- /dev/null
+++ b/Zend/tests/namespace_first_stmt_nop.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Nop statement before namespace
+--FILE--
+<?php
+;
+namespace Foo;
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/namespace_name_namespace.phpt b/Zend/tests/namespace_name_namespace.phpt
new file mode 100644
index 0000000000..311705ab2e
--- /dev/null
+++ b/Zend/tests/namespace_name_namespace.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot use "namespace" as namespace name, due to conflict with ns-relative names
+--FILE--
+<?php
+
+namespace NAMEspace;
+
+?>
+--EXPECTF--
+Fatal error: Cannot use 'NAMEspace' as namespace name in %s on line %d
diff --git a/Zend/tests/namespace_name_namespace_start.phpt b/Zend/tests/namespace_name_namespace_start.phpt
new file mode 100644
index 0000000000..bf812fed79
--- /dev/null
+++ b/Zend/tests/namespace_name_namespace_start.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Cannot use "namespace\xyz" as namespace name, due to conflict with ns-relative names
+--FILE--
+<?php
+
+namespace NAMEspace\xyz;
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected namespace-relative name "NAMEspace\xyz", expecting "{" in %s on line %d
diff --git a/Zend/tests/namespace_name_reserved_keywords.phpt b/Zend/tests/namespace_name_reserved_keywords.phpt
new file mode 100644
index 0000000000..9374ef6a63
--- /dev/null
+++ b/Zend/tests/namespace_name_reserved_keywords.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Reserved keywords in namespace name
+--FILE--
+<?php
+
+namespace iter\fn {
+ function test() {
+ echo __FUNCTION__, "\n";
+ }
+}
+
+namespace fn {
+ function test() {
+ echo __FUNCTION__, "\n";
+ }
+}
+
+namespace self {
+ function test() {
+ echo __FUNCTION__, "\n";
+ }
+}
+
+namespace {
+ use iter\fn;
+ use function fn\test as test2;
+ use function self\test as test3;
+ fn\test();
+ test2();
+ test3();
+}
+
+?>
+--EXPECT--
+iter\fn\test
+fn\test
+self\test
diff --git a/Zend/tests/namespaced_name_whitespace.phpt b/Zend/tests/namespaced_name_whitespace.phpt
new file mode 100644
index 0000000000..746b3298e9
--- /dev/null
+++ b/Zend/tests/namespaced_name_whitespace.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Whitespace between namespace separators is no longer allowed
+--FILE--
+<?php
+
+Foo \ Bar \ Baz;
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected token "\" in %s on line %d
diff --git a/Zend/tests/nested_method_and_function.phpt b/Zend/tests/nested_method_and_function.phpt
index 3d19a06088..5965a9274c 100644
--- a/Zend/tests/nested_method_and_function.phpt
+++ b/Zend/tests/nested_method_and_function.phpt
@@ -6,21 +6,21 @@ active_class_entry must be always correct (__METHOD__ should not depend on decla
namespace Baz;
class Foo {
- public static function bar() {
- function foo() {
- var_dump(__FUNCTION__);
- var_dump(__METHOD__);
- var_dump(__CLASS__);
- }
+ public static function bar() {
+ function foo() {
+ var_dump(__FUNCTION__);
+ var_dump(__METHOD__);
+ var_dump(__CLASS__);
+ }
- foo();
+ foo();
- var_dump(__FUNCTION__);
- var_dump(__METHOD__);
- var_dump(__CLASS__);
+ var_dump(__FUNCTION__);
+ var_dump(__METHOD__);
+ var_dump(__CLASS__);
- return function() {var_dump(__FUNCTION__); var_dump(__METHOD__); var_dump(__CLASS__); };
- }
+ return function() {var_dump(__FUNCTION__); var_dump(__METHOD__); var_dump(__CLASS__); };
+ }
}
$c = Foo::bar();
diff --git a/Zend/tests/non_well_formed_param_exception.phpt b/Zend/tests/non_well_formed_param_exception.phpt
deleted file mode 100644
index d688375f9f..0000000000
--- a/Zend/tests/non_well_formed_param_exception.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-A "non well formed" notice converted to exception should result in a ZPP failure
---FILE--
-<?php
-
-set_error_handler(function($_, $msg) {
- throw new Exception($msg);
-}, E_NOTICE);
-
-try {
- wordwrap("foo", "123foo", "");
-} catch (Exception $e) {
- echo $e, "\n";
-}
-
-?>
---EXPECTF--
-Exception: A non well formed numeric value encountered in %s:%d
-Stack trace:
-#0 [internal function]: {closure}(%s)
-#1 %s(%d): wordwrap('foo', '123foo', '')
-#2 {main}
diff --git a/Zend/tests/not_002.phpt b/Zend/tests/not_002.phpt
index 11efcaa2ea..3282053b6b 100644
--- a/Zend/tests/not_002.phpt
+++ b/Zend/tests/not_002.phpt
@@ -7,9 +7,9 @@ $a = array(1,2,3);
$b = array(1,2);
try {
- var_dump(~$b);
+ var_dump(~$b);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$a = ~$b;
@@ -18,9 +18,9 @@ var_dump($a);
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types
+Exception: Cannot perform bitwise not on array
-Fatal error: Uncaught Error: Unsupported operand types in %s:%d
+Fatal error: Uncaught TypeError: Cannot perform bitwise not on array in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/nowdoc_015.phpt b/Zend/tests/nowdoc_015.phpt
index 9eb83bd063..3b02273920 100644
--- a/Zend/tests/nowdoc_015.phpt
+++ b/Zend/tests/nowdoc_015.phpt
@@ -2,8 +2,8 @@
Test nowdoc and line numbering
--FILE--
<?php
-function error_handler($num, $msg, $file, $line, $vars) {
- echo $line,"\n";
+function error_handler($num, $msg, $file, $line) {
+ echo $line,"\n";
}
set_error_handler('error_handler');
trigger_error("line", E_USER_ERROR);
diff --git a/Zend/tests/ns_001.phpt b/Zend/tests/ns_001.phpt
index 100dbe50e9..ef12ce5aaf 100644
--- a/Zend/tests/ns_001.phpt
+++ b/Zend/tests/ns_001.phpt
@@ -25,6 +25,7 @@ Foo::baz();
$y = new \test\ns1\Foo;
$y->bar();
\test\ns1\Foo::baz();
+?>
--EXPECT--
test\ns1\Foo
test\ns1\Foo
diff --git a/Zend/tests/ns_002.phpt b/Zend/tests/ns_002.phpt
index 3d9e09869d..fa937d4421 100644
--- a/Zend/tests/ns_002.phpt
+++ b/Zend/tests/ns_002.phpt
@@ -19,6 +19,7 @@ Foo::bar();
Bar::bar();
ns2\Foo::bar();
ns1\Foo::bar();
+?>
--EXPECT--
test\ns1\Foo
test\ns1\Foo
diff --git a/Zend/tests/ns_003.phpt b/Zend/tests/ns_003.phpt
index 4372722c25..5cc0c64441 100644
--- a/Zend/tests/ns_003.phpt
+++ b/Zend/tests/ns_003.phpt
@@ -8,5 +8,6 @@ class Exception {
}
echo get_class(new Exception()),"\n";
+?>
--EXPECT--
test\ns1\Exception
diff --git a/Zend/tests/ns_004.phpt b/Zend/tests/ns_004.phpt
index f04f662e0a..1c2395351b 100644
--- a/Zend/tests/ns_004.phpt
+++ b/Zend/tests/ns_004.phpt
@@ -5,8 +5,9 @@
namespace test\ns1;
echo get_class(new Exception()),"\n";
+?>
--EXPECTF--
-Fatal error: Uncaught Error: Class 'test\ns1\Exception' not found in %sns_004.php:%d
+Fatal error: Uncaught Error: Class "test\ns1\Exception" not found in %s:%d
Stack trace:
#0 {main}
thrown in %sns_004.php on line %d
diff --git a/Zend/tests/ns_005.phpt b/Zend/tests/ns_005.phpt
index c082afc481..b2d3b98682 100644
--- a/Zend/tests/ns_005.phpt
+++ b/Zend/tests/ns_005.phpt
@@ -8,5 +8,6 @@ class Exception {
}
echo get_class(new \Exception()),"\n";
+?>
--EXPECT--
Exception
diff --git a/Zend/tests/ns_006.phpt b/Zend/tests/ns_006.phpt
index 1c0ec3ab08..60a4702c0f 100644
--- a/Zend/tests/ns_006.phpt
+++ b/Zend/tests/ns_006.phpt
@@ -9,5 +9,6 @@ class Exception {
$x = "test\\ns1\\Exception";
echo get_class(new $x),"\n";
+?>
--EXPECT--
test\ns1\Exception
diff --git a/Zend/tests/ns_007.phpt b/Zend/tests/ns_007.phpt
index 2f4d1361dc..9d3e201b9f 100644
--- a/Zend/tests/ns_007.phpt
+++ b/Zend/tests/ns_007.phpt
@@ -9,5 +9,6 @@ class Exception {
$x = "Exception";
echo get_class(new $x),"\n";
+?>
--EXPECT--
Exception
diff --git a/Zend/tests/ns_008.phpt b/Zend/tests/ns_008.phpt
index a0ae4e2d8f..0be955b2b2 100644
--- a/Zend/tests/ns_008.phpt
+++ b/Zend/tests/ns_008.phpt
@@ -9,5 +9,6 @@ class foo {
$x = __NAMESPACE__ . "\\foo";
echo get_class(new $x),"\n";
+?>
--EXPECT--
test\foo
diff --git a/Zend/tests/ns_009.phpt b/Zend/tests/ns_009.phpt
index 21d2f00cc0..c5a76f69a4 100644
--- a/Zend/tests/ns_009.phpt
+++ b/Zend/tests/ns_009.phpt
@@ -7,5 +7,6 @@ class foo {
$x = __NAMESPACE__ . "\\foo";
echo get_class(new $x),"\n";
+?>
--EXPECT--
foo
diff --git a/Zend/tests/ns_010.phpt b/Zend/tests/ns_010.phpt
index e0ccd349ed..d718f7cc5b 100644
--- a/Zend/tests/ns_010.phpt
+++ b/Zend/tests/ns_010.phpt
@@ -5,14 +5,14 @@
namespace X;
use X as Y;
class Foo {
- const C = "const ok\n";
- static $var = "var ok\n";
- function __construct() {
- echo "class ok\n";
- }
- static function bar() {
- echo "method ok\n";
- }
+ const C = "const ok\n";
+ static $var = "var ok\n";
+ function __construct() {
+ echo "class ok\n";
+ }
+ static function bar() {
+ echo "method ok\n";
+ }
}
new Foo();
new Y\Foo();
@@ -26,6 +26,7 @@ echo \X\Foo::C;
echo Foo::$var;
echo Y\Foo::$var;
echo \X\Foo::$var;
+?>
--EXPECT--
class ok
class ok
diff --git a/Zend/tests/ns_011.phpt b/Zend/tests/ns_011.phpt
index 7aa6270a1c..900b9e5764 100644
--- a/Zend/tests/ns_011.phpt
+++ b/Zend/tests/ns_011.phpt
@@ -16,6 +16,7 @@ bar();
function bar() {
echo __FUNCTION__,"\n";
}
+?>
--EXPECT--
test\ns1\foo
test\ns1\foo
diff --git a/Zend/tests/ns_012.phpt b/Zend/tests/ns_012.phpt
index 210cba9065..186f056f6a 100644
--- a/Zend/tests/ns_012.phpt
+++ b/Zend/tests/ns_012.phpt
@@ -23,6 +23,7 @@ ns3\ns1\bar();
function bar() {
echo __FUNCTION__,"\n";
}
+?>
--EXPECT--
test\ns1\foo
test\ns1\bar
diff --git a/Zend/tests/ns_013.phpt b/Zend/tests/ns_013.phpt
index ef73b1395f..f268fe2f96 100644
--- a/Zend/tests/ns_013.phpt
+++ b/Zend/tests/ns_013.phpt
@@ -5,9 +5,10 @@
namespace test\ns1;
function strlen($x) {
- return __FUNCTION__;
+ return __FUNCTION__;
}
echo strlen("Hello"),"\n";
+?>
--EXPECT--
test\ns1\strlen
diff --git a/Zend/tests/ns_014.phpt b/Zend/tests/ns_014.phpt
index 6bcab51c83..547bd998d4 100644
--- a/Zend/tests/ns_014.phpt
+++ b/Zend/tests/ns_014.phpt
@@ -5,5 +5,6 @@
namespace test\ns1;
echo strlen("Hello"),"\n";
+?>
--EXPECT--
5
diff --git a/Zend/tests/ns_015.phpt b/Zend/tests/ns_015.phpt
index 405d3e4518..cbbcc94b36 100644
--- a/Zend/tests/ns_015.phpt
+++ b/Zend/tests/ns_015.phpt
@@ -5,9 +5,10 @@
namespace test\ns1;
function strlen($x) {
- return __FUNCTION__;
+ return __FUNCTION__;
}
echo \strlen("Hello"),"\n";
+?>
--EXPECT--
5
diff --git a/Zend/tests/ns_016.phpt b/Zend/tests/ns_016.phpt
index bee8b5bee3..87682d485a 100644
--- a/Zend/tests/ns_016.phpt
+++ b/Zend/tests/ns_016.phpt
@@ -5,10 +5,11 @@
namespace test\ns1;
function strlen($x) {
- return __FUNCTION__;
+ return __FUNCTION__;
}
$x = "test\\ns1\\strlen";
echo $x("Hello"),"\n";
+?>
--EXPECT--
test\ns1\strlen
diff --git a/Zend/tests/ns_017.phpt b/Zend/tests/ns_017.phpt
index d48afd5f01..886a7394f0 100644
--- a/Zend/tests/ns_017.phpt
+++ b/Zend/tests/ns_017.phpt
@@ -5,10 +5,11 @@
namespace test\ns1;
function strlen($x) {
- return __FUNCTION__;
+ return __FUNCTION__;
}
$x = "strlen";
echo $x("Hello"),"\n";
+?>
--EXPECT--
5
diff --git a/Zend/tests/ns_018.phpt b/Zend/tests/ns_018.phpt
index 9ad2fb89b5..d420a862d3 100644
--- a/Zend/tests/ns_018.phpt
+++ b/Zend/tests/ns_018.phpt
@@ -5,10 +5,11 @@
namespace test;
function foo() {
- return __FUNCTION__;
+ return __FUNCTION__;
}
$x = __NAMESPACE__ . "\\foo";
echo $x(),"\n";
+?>
--EXPECT--
test\foo
diff --git a/Zend/tests/ns_019.phpt b/Zend/tests/ns_019.phpt
index 91aea33e10..8b06809072 100644
--- a/Zend/tests/ns_019.phpt
+++ b/Zend/tests/ns_019.phpt
@@ -3,10 +3,11 @@
--FILE--
<?php
function foo() {
- return __FUNCTION__;
+ return __FUNCTION__;
}
$x = __NAMESPACE__ . "\\foo";
echo $x(),"\n";
+?>
--EXPECT--
foo
diff --git a/Zend/tests/ns_020.phpt b/Zend/tests/ns_020.phpt
index 5a391771e9..268fd5b692 100644
--- a/Zend/tests/ns_020.phpt
+++ b/Zend/tests/ns_020.phpt
@@ -5,12 +5,13 @@
namespace X;
use X as Y;
function foo() {
- echo __FUNCTION__,"\n";
+ echo __FUNCTION__,"\n";
}
foo();
\X\foo();
Y\foo();
\X\foo();
+?>
--EXPECT--
X\foo
X\foo
diff --git a/Zend/tests/ns_021.phpt b/Zend/tests/ns_021.phpt
index 405468399f..3537488149 100644
--- a/Zend/tests/ns_021.phpt
+++ b/Zend/tests/ns_021.phpt
@@ -5,18 +5,19 @@
namespace test;
class Test {
- static function foo() {
- echo __CLASS__,"::",__FUNCTION__,"\n";
- }
+ static function foo() {
+ echo __CLASS__,"::",__FUNCTION__,"\n";
+ }
}
function foo() {
- echo __FUNCTION__,"\n";
+ echo __FUNCTION__,"\n";
}
foo();
\test\foo();
\test\test::foo();
+?>
--EXPECT--
test\foo
test\foo
diff --git a/Zend/tests/ns_022.inc b/Zend/tests/ns_022.inc
index be571fc346..a6faae8c3b 100644
--- a/Zend/tests/ns_022.inc
+++ b/Zend/tests/ns_022.inc
@@ -1,6 +1,6 @@
<?php
class Test {
- static function foo() {
- echo __CLASS__,"::",__FUNCTION__,"\n";
- }
+ static function foo() {
+ echo __CLASS__,"::",__FUNCTION__,"\n";
+ }
}
diff --git a/Zend/tests/ns_022.phpt b/Zend/tests/ns_022.phpt
index 7aebe1d5a2..27b4b3df24 100644
--- a/Zend/tests/ns_022.phpt
+++ b/Zend/tests/ns_022.phpt
@@ -9,11 +9,12 @@ use a\b\c as test;
require "ns_022.inc";
function foo() {
- echo __FUNCTION__,"\n";
+ echo __FUNCTION__,"\n";
}
test\foo();
\test::foo();
+?>
--EXPECT--
a\b\c\foo
Test::foo
diff --git a/Zend/tests/ns_023.phpt b/Zend/tests/ns_023.phpt
index 34fbb56f2a..ed9c3e52de 100644
--- a/Zend/tests/ns_023.phpt
+++ b/Zend/tests/ns_023.phpt
@@ -5,5 +5,6 @@
namespace test\foo;
var_dump(__NAMESPACE__);
+?>
--EXPECT--
string(8) "test\foo"
diff --git a/Zend/tests/ns_024.phpt b/Zend/tests/ns_024.phpt
index 019a89c470..4a6e72f326 100644
--- a/Zend/tests/ns_024.phpt
+++ b/Zend/tests/ns_024.phpt
@@ -3,5 +3,6 @@
--FILE--
<?php
var_dump(__NAMESPACE__);
+?>
--EXPECT--
string(0) ""
diff --git a/Zend/tests/ns_025.phpt b/Zend/tests/ns_025.phpt
index 917a710d95..4742b45e9e 100644
--- a/Zend/tests/ns_025.phpt
+++ b/Zend/tests/ns_025.phpt
@@ -6,10 +6,10 @@ namespace Foo\Bar;
class Foo {
function __construct() {
- echo __CLASS__,"\n";
+ echo __CLASS__,"\n";
}
static function Bar() {
- echo __CLASS__,"\n";
+ echo __CLASS__,"\n";
}
}
@@ -17,6 +17,7 @@ $x = new Foo;
Foo::Bar();
$x = new \Foo\Bar\Foo;
\Foo\Bar\Foo::Bar();
+?>
--EXPECT--
Foo\Bar\Foo
Foo\Bar\Foo
diff --git a/Zend/tests/ns_026.phpt b/Zend/tests/ns_026.phpt
index 530e135230..6d7502d8cd 100644
--- a/Zend/tests/ns_026.phpt
+++ b/Zend/tests/ns_026.phpt
@@ -8,10 +8,10 @@ namespace Foo;
class Foo {
function __construct() {
- echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
+ echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
}
static function Bar() {
- echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
+ echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
}
}
@@ -25,6 +25,7 @@ $x = new \Foo\Foo;
\Foo\Foo::Bar();
\Foo\Bar();
Foo\Bar();
+?>
--EXPECTF--
Method - Foo\Foo::__construct
Func - Foo\Bar
diff --git a/Zend/tests/ns_027.inc b/Zend/tests/ns_027.inc
index 3823818290..96d4c0d7c7 100644
--- a/Zend/tests/ns_027.inc
+++ b/Zend/tests/ns_027.inc
@@ -3,9 +3,9 @@ namespace Foo\Bar;
class Foo {
function __construct() {
- echo __CLASS__,"\n";
+ echo __CLASS__,"\n";
}
static function Bar() {
- echo __CLASS__,"\n";
+ echo __CLASS__,"\n";
}
}
diff --git a/Zend/tests/ns_027.phpt b/Zend/tests/ns_027.phpt
index 88ef22f93b..574cc4b0fa 100644
--- a/Zend/tests/ns_027.phpt
+++ b/Zend/tests/ns_027.phpt
@@ -6,10 +6,10 @@ require "ns_027.inc";
class Foo {
function __construct() {
- echo __CLASS__,"\n";
+ echo __CLASS__,"\n";
}
static function Bar() {
- echo __CLASS__,"\n";
+ echo __CLASS__,"\n";
}
}
@@ -17,6 +17,7 @@ $x = new Foo;
Foo::Bar();
$x = new Foo\Bar\Foo;
Foo\Bar\Foo::Bar();
+?>
--EXPECT--
Foo
Foo
diff --git a/Zend/tests/ns_028.inc b/Zend/tests/ns_028.inc
index 5bd3ae7765..caa1881850 100644
--- a/Zend/tests/ns_028.inc
+++ b/Zend/tests/ns_028.inc
@@ -3,10 +3,10 @@ namespace Foo;
class Foo {
function __construct() {
- echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
+ echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
}
static function Bar() {
- echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
+ echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
}
}
diff --git a/Zend/tests/ns_028.phpt b/Zend/tests/ns_028.phpt
index ec23dac818..ea5eafebc4 100644
--- a/Zend/tests/ns_028.phpt
+++ b/Zend/tests/ns_028.phpt
@@ -6,10 +6,10 @@ require "ns_028.inc";
class Foo {
function __construct() {
- echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
+ echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
}
static function Bar() {
- echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
+ echo "Method - ".__CLASS__."::".__FUNCTION__."\n";
}
}
@@ -18,6 +18,7 @@ Foo\Bar();
$x = new Foo\Foo;
Foo\Foo::Bar();
\Foo\Bar();
+?>
--EXPECT--
Method - Foo::__construct
Func - Foo\Bar
diff --git a/Zend/tests/ns_029.phpt b/Zend/tests/ns_029.phpt
index f1aa954ae3..d053a9a337 100644
--- a/Zend/tests/ns_029.phpt
+++ b/Zend/tests/ns_029.phpt
@@ -8,5 +8,6 @@ class Foo {
}
new Foo();
+?>
--EXPECTF--
Fatal error: Cannot declare class Foo because the name is already in use in %sns_029.php on line 4
diff --git a/Zend/tests/ns_030.phpt b/Zend/tests/ns_030.phpt
index 69724159ee..d275bc23cc 100644
--- a/Zend/tests/ns_030.phpt
+++ b/Zend/tests/ns_030.phpt
@@ -8,5 +8,6 @@ class Foo {
use A\B as Foo;
new Foo();
+?>
--EXPECTF--
Fatal error: Cannot use A\B as Foo because the name is already in use in %sns_030.php on line 5
diff --git a/Zend/tests/ns_031.phpt b/Zend/tests/ns_031.phpt
index 840c08621c..71465a232e 100644
--- a/Zend/tests/ns_031.phpt
+++ b/Zend/tests/ns_031.phpt
@@ -5,17 +5,18 @@
namespace test;
class Test {
- static function foo() {
- echo __CLASS__,"::",__FUNCTION__,"\n";
- }
+ static function foo() {
+ echo __CLASS__,"::",__FUNCTION__,"\n";
+ }
}
function foo() {
- echo __FUNCTION__,"\n";
+ echo __FUNCTION__,"\n";
}
call_user_func(__NAMESPACE__."\\foo");
call_user_func(__NAMESPACE__."\\test::foo");
+?>
--EXPECT--
test\foo
test\Test::foo
diff --git a/Zend/tests/ns_032.phpt b/Zend/tests/ns_032.phpt
index 5717a33685..562495dd57 100644
--- a/Zend/tests/ns_032.phpt
+++ b/Zend/tests/ns_032.phpt
@@ -3,17 +3,18 @@
--FILE--
<?php
class Test {
- static function foo() {
- echo __CLASS__,"::",__FUNCTION__,"\n";
- }
+ static function foo() {
+ echo __CLASS__,"::",__FUNCTION__,"\n";
+ }
}
function foo() {
- echo __FUNCTION__,"\n";
+ echo __FUNCTION__,"\n";
}
call_user_func(__NAMESPACE__."\\foo");
call_user_func(__NAMESPACE__."\\test::foo");
+?>
--EXPECT--
foo
Test::foo
diff --git a/Zend/tests/ns_033.phpt b/Zend/tests/ns_033.phpt
index ba40683002..39bcf80916 100644
--- a/Zend/tests/ns_033.phpt
+++ b/Zend/tests/ns_033.phpt
@@ -4,6 +4,7 @@
<?php
use A;
use \B;
+?>
--EXPECTF--
Warning: The use statement with non-compound name 'A' has no effect in %sns_033.php on line 2
diff --git a/Zend/tests/ns_034.phpt b/Zend/tests/ns_034.phpt
index 76775f1180..7828dadad2 100644
--- a/Zend/tests/ns_034.phpt
+++ b/Zend/tests/ns_034.phpt
@@ -5,16 +5,16 @@
namespace A;
use A as B;
class Foo {
- const C = "ok\n";
+ const C = "ok\n";
}
function f1($x=Foo::C) {
- echo $x;
+ echo $x;
}
function f2($x=B\Foo::C) {
- echo $x;
+ echo $x;
}
function f3($x=\A\Foo::C) {
- echo $x;
+ echo $x;
}
echo Foo::C;
echo B\Foo::C;
@@ -22,6 +22,7 @@ echo \A\Foo::C;
f1();
f2();
f3();
+?>
--EXPECT--
ok
ok
diff --git a/Zend/tests/ns_035.phpt b/Zend/tests/ns_035.phpt
index 7fdf7d83f3..bf429114d6 100644
--- a/Zend/tests/ns_035.phpt
+++ b/Zend/tests/ns_035.phpt
@@ -6,10 +6,10 @@ namespace A;
use \ArrayObject;
function f1($x = ArrayObject::STD_PROP_LIST) {
- var_dump($x);
+ var_dump($x);
}
function f2($x = \ArrayObject::STD_PROP_LIST) {
- var_dump($x);
+ var_dump($x);
}
var_dump(ArrayObject::STD_PROP_LIST);
var_dump(\ArrayObject::STD_PROP_LIST);
diff --git a/Zend/tests/ns_036.phpt b/Zend/tests/ns_036.phpt
index 0458a38df0..0255a4f439 100644
--- a/Zend/tests/ns_036.phpt
+++ b/Zend/tests/ns_036.phpt
@@ -5,19 +5,19 @@
namespace A;
use A as B;
class ArrayObject {
- const STD_PROP_LIST = 2;
+ const STD_PROP_LIST = 2;
}
function f1($x = ArrayObject::STD_PROP_LIST) {
- var_dump($x);
+ var_dump($x);
}
function f2($x = \ArrayObject::STD_PROP_LIST) {
- var_dump($x);
+ var_dump($x);
}
function f3($x = \A\ArrayObject::STD_PROP_LIST) {
- var_dump($x);
+ var_dump($x);
}
function f4($x = B\ArrayObject::STD_PROP_LIST) {
- var_dump($x);
+ var_dump($x);
}
var_dump(ArrayObject::STD_PROP_LIST);
var_dump(\ArrayObject::STD_PROP_LIST);
diff --git a/Zend/tests/ns_037.phpt b/Zend/tests/ns_037.phpt
index db0a76e940..88aec27c57 100644
--- a/Zend/tests/ns_037.phpt
+++ b/Zend/tests/ns_037.phpt
@@ -5,14 +5,14 @@
namespace X;
use X as Y;
class X {
- const C = "const ok\n";
- static $var = "var ok\n";
- function __construct() {
- echo "class ok\n";
- }
- static function bar() {
- echo "method ok\n";
- }
+ const C = "const ok\n";
+ static $var = "var ok\n";
+ function __construct() {
+ echo "class ok\n";
+ }
+ static function bar() {
+ echo "method ok\n";
+ }
}
new X();
new Y\X();
@@ -26,6 +26,7 @@ echo \X\X::C;
echo X::$var;
echo Y\X::$var;
echo \X\X::$var;
+?>
--EXPECT--
class ok
class ok
diff --git a/Zend/tests/ns_038.phpt b/Zend/tests/ns_038.phpt
index f514de77c9..c5ac087348 100644
--- a/Zend/tests/ns_038.phpt
+++ b/Zend/tests/ns_038.phpt
@@ -8,10 +8,11 @@ function foo() {
}
\Exception\foo();
\Exception::bar();
+?>
--EXPECTF--
ok
-Fatal error: Uncaught Error: Call to undefined method Exception::bar() in %sns_038.php:7
+Fatal error: Uncaught Error: Call to undefined method Exception::bar() in %s:%d
Stack trace:
#0 {main}
thrown in %sns_038.php on line 7
diff --git a/Zend/tests/ns_039.phpt b/Zend/tests/ns_039.phpt
index c5e79e48c5..64cd85a0f3 100644
--- a/Zend/tests/ns_039.phpt
+++ b/Zend/tests/ns_039.phpt
@@ -3,13 +3,13 @@
--FILE--
<?php
function foo($a = A) {
- echo "$a\n";
+ echo "$a\n";
}
function bar($a = array(A => B)) {
- foreach ($a as $key => $val) {
- echo "$key\n";
- echo "$val\n";
- }
+ foreach ($a as $key => $val) {
+ echo "$key\n";
+ echo "$val\n";
+ }
}
const A = "ok";
const B = A;
@@ -17,6 +17,7 @@ echo A . "\n";
echo B . "\n";
foo();
bar();
+?>
--EXPECT--
ok
ok
diff --git a/Zend/tests/ns_040.phpt b/Zend/tests/ns_040.phpt
index 42a3ac07e9..ac776e13b7 100644
--- a/Zend/tests/ns_040.phpt
+++ b/Zend/tests/ns_040.phpt
@@ -7,28 +7,28 @@ use X as Y;
const A = "ok\n";
const B = A;
function f1($x=A) {
- echo $x;
+ echo $x;
}
function f2($x=\X\A) {
- echo $x;
+ echo $x;
}
function f3($x=Y\A) {
- echo $x;
+ echo $x;
}
function f4($x=\X\A) {
- echo $x;
+ echo $x;
}
function f5($x=B) {
- echo $x;
+ echo $x;
}
function f6($x=array(A)) {
- echo $x[0];
+ echo $x[0];
}
function f7($x=array("aaa"=>A)) {
- echo $x["aaa"];
+ echo $x["aaa"];
}
function f8($x=array(A=>"aaa\n")) {
- echo $x["ok\n"];
+ echo $x["ok\n"];
}
echo A;
echo \X\A;
@@ -43,6 +43,7 @@ f5();
f6();
f7();
f8();
+?>
--EXPECT--
ok
ok
diff --git a/Zend/tests/ns_041.phpt b/Zend/tests/ns_041.phpt
index bd9dfbd093..a77b74eaf5 100644
--- a/Zend/tests/ns_041.phpt
+++ b/Zend/tests/ns_041.phpt
@@ -12,10 +12,13 @@ echo(\test\ns1\FOO);
echo(BAR);
const BAR = "ok\n";
+?>
--EXPECTF--
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_042.phpt b/Zend/tests/ns_042.phpt
index ba420a7c80..3ab9bc8cd3 100644
--- a/Zend/tests/ns_042.phpt
+++ b/Zend/tests/ns_042.phpt
@@ -14,6 +14,7 @@ echo \test\ns1\FOO;
echo \test\ns1\FOO;
echo ns2\FOO;
echo ns3\ns1\FOO;
+?>
--EXPECT--
ok
ok
diff --git a/Zend/tests/ns_043.phpt b/Zend/tests/ns_043.phpt
index bd5ee7440b..efd24156ca 100644
--- a/Zend/tests/ns_043.phpt
+++ b/Zend/tests/ns_043.phpt
@@ -7,5 +7,6 @@ namespace test\ns1;
const INI_ALL = 0;
var_dump(INI_ALL);
+?>
--EXPECT--
int(0)
diff --git a/Zend/tests/ns_044.phpt b/Zend/tests/ns_044.phpt
index dbdee2e523..89c426c774 100644
--- a/Zend/tests/ns_044.phpt
+++ b/Zend/tests/ns_044.phpt
@@ -5,5 +5,6 @@
namespace test\ns1;
var_dump(INI_ALL);
+?>
--EXPECT--
int(7)
diff --git a/Zend/tests/ns_045.phpt b/Zend/tests/ns_045.phpt
index d45f9cf99d..7a301bbcb1 100644
--- a/Zend/tests/ns_045.phpt
+++ b/Zend/tests/ns_045.phpt
@@ -7,5 +7,6 @@ namespace test\ns1;
const INI_ALL = 0;
var_dump(\INI_ALL);
+?>
--EXPECT--
int(7)
diff --git a/Zend/tests/ns_046.phpt b/Zend/tests/ns_046.phpt
index d5203f14dc..1b04bd2ff2 100644
--- a/Zend/tests/ns_046.phpt
+++ b/Zend/tests/ns_046.phpt
@@ -7,5 +7,6 @@ namespace test\ns1;
const INI_ALL = 0;
var_dump(constant("test\\ns1\\INI_ALL"));
+?>
--EXPECT--
int(0)
diff --git a/Zend/tests/ns_047.phpt b/Zend/tests/ns_047.phpt
index 73e32a0de7..edbd33e1a6 100644
--- a/Zend/tests/ns_047.phpt
+++ b/Zend/tests/ns_047.phpt
@@ -7,5 +7,6 @@ namespace test\ns1;
const INI_ALL = 0;
var_dump(constant("INI_ALL"));
+?>
--EXPECT--
int(7)
diff --git a/Zend/tests/ns_048.phpt b/Zend/tests/ns_048.phpt
index db21f89103..ac9e5c2d50 100644
--- a/Zend/tests/ns_048.phpt
+++ b/Zend/tests/ns_048.phpt
@@ -7,5 +7,6 @@ namespace test\ns1;
const FOO = 0;
var_dump(constant(__NAMESPACE__ . "\\FOO"));
+?>
--EXPECT--
int(0)
diff --git a/Zend/tests/ns_049.phpt b/Zend/tests/ns_049.phpt
index 91e516579b..1a9f3d8d7b 100644
--- a/Zend/tests/ns_049.phpt
+++ b/Zend/tests/ns_049.phpt
@@ -5,5 +5,6 @@
const FOO = 0;
var_dump(constant(__NAMESPACE__ . "\\FOO"));
+?>
--EXPECT--
int(0)
diff --git a/Zend/tests/ns_050.phpt b/Zend/tests/ns_050.phpt
index f827ec858d..33be1b7f24 100644
--- a/Zend/tests/ns_050.phpt
+++ b/Zend/tests/ns_050.phpt
@@ -7,8 +7,9 @@ namespace test\ns1;
const INI_ALL = 0;
function foo($x = INI_ALL) {
- var_dump($x);
+ var_dump($x);
}
foo();
+?>
--EXPECT--
int(0)
diff --git a/Zend/tests/ns_051.phpt b/Zend/tests/ns_051.phpt
index b95b53f78b..1cb6b00db0 100644
--- a/Zend/tests/ns_051.phpt
+++ b/Zend/tests/ns_051.phpt
@@ -5,8 +5,9 @@
namespace test\ns1;
function foo($x = INI_ALL) {
- var_dump($x);
+ var_dump($x);
}
foo();
+?>
--EXPECT--
int(7)
diff --git a/Zend/tests/ns_052.phpt b/Zend/tests/ns_052.phpt
index cb0a05ff9f..fdd04163a7 100644
--- a/Zend/tests/ns_052.phpt
+++ b/Zend/tests/ns_052.phpt
@@ -7,8 +7,9 @@ namespace test\ns1;
const INI_ALL = 0;
function foo($x = \INI_ALL) {
- var_dump($x);
+ var_dump($x);
}
foo();
+?>
--EXPECT--
int(7)
diff --git a/Zend/tests/ns_053.phpt b/Zend/tests/ns_053.phpt
index dd3ff76693..56e408eec4 100644
--- a/Zend/tests/ns_053.phpt
+++ b/Zend/tests/ns_053.phpt
@@ -7,6 +7,7 @@ namespace test\ns1;
define(__NAMESPACE__ . '\\NAME', basename(__FILE__));
echo NAME."\n";
echo \test\ns1\NAME."\n";
+?>
--EXPECT--
ns_053.php
ns_053.php
diff --git a/Zend/tests/ns_054.phpt b/Zend/tests/ns_054.phpt
index c6dd2553f8..9b8defc9ac 100644
--- a/Zend/tests/ns_054.phpt
+++ b/Zend/tests/ns_054.phpt
@@ -5,19 +5,19 @@
namespace test\ns1;
class Foo implements \SplObserver {
- function update(\SplSubject $x) {
- echo "ok\n";
- }
+ function update(\SplSubject $x) {
+ echo "ok\n";
+ }
}
class Bar implements \SplSubject {
- function attach(\SplObserver $x) {
- echo "ok\n";
- }
- function notify() {
- }
- function detach(\SplObserver $x) {
- }
+ function attach(\SplObserver $x) {
+ echo "ok\n";
+ }
+ function notify() {
+ }
+ function detach(\SplObserver $x) {
+ }
}
$foo = new Foo();
$bar = new Bar();
diff --git a/Zend/tests/ns_055.phpt b/Zend/tests/ns_055.phpt
index 16e3e69777..9df9c2b007 100644
--- a/Zend/tests/ns_055.phpt
+++ b/Zend/tests/ns_055.phpt
@@ -5,15 +5,15 @@
namespace test\ns1;
class Foo {
- function test1(Foo $x) {
- echo "ok\n";
- }
- function test2(\test\ns1\Foo $x) {
- echo "ok\n";
- }
- function test3(\Exception $x) {
- echo "ok\n";
- }
+ function test1(Foo $x) {
+ echo "ok\n";
+ }
+ function test2(\test\ns1\Foo $x) {
+ echo "ok\n";
+ }
+ function test3(\Exception $x) {
+ echo "ok\n";
+ }
}
$foo = new Foo();
diff --git a/Zend/tests/ns_056.phpt b/Zend/tests/ns_056.phpt
index b61609793d..cc61c7f8f1 100644
--- a/Zend/tests/ns_056.phpt
+++ b/Zend/tests/ns_056.phpt
@@ -6,19 +6,19 @@ namespace test\ns1;
use \SplObserver;
class Foo implements SplObserver {
- function update(\SplSubject $x) {
- echo "ok\n";
- }
+ function update(\SplSubject $x) {
+ echo "ok\n";
+ }
}
class Bar implements \SplSubject {
- function attach(SplObserver $x) {
- echo "ok\n";
- }
- function notify() {
- }
- function detach(SplObserver $x) {
- }
+ function attach(SplObserver $x) {
+ echo "ok\n";
+ }
+ function notify() {
+ }
+ function detach(SplObserver $x) {
+ }
}
$foo = new Foo();
$bar = new Bar();
diff --git a/Zend/tests/ns_057.phpt b/Zend/tests/ns_057.phpt
index 6c7a72f86e..257bbedb3e 100644
--- a/Zend/tests/ns_057.phpt
+++ b/Zend/tests/ns_057.phpt
@@ -7,30 +7,30 @@ namespace Test\ns1;
const C = "const ok\n";
function foo() {
- return "func ok\n";
+ return "func ok\n";
}
class foo {
- const C = "const ok\n";
- const C2 = namespace\C;
- static $var = "var ok\n";
- function __construct() {
- echo "class ok\n";
- }
- static function bar() {
- return "method ok\n";
- }
+ const C = "const ok\n";
+ const C2 = namespace\C;
+ static $var = "var ok\n";
+ function __construct() {
+ echo "class ok\n";
+ }
+ static function bar() {
+ return "method ok\n";
+ }
}
function f1($x=namespace\C) {
- return $x;
+ return $x;
}
function f2($x=namespace\foo::C) {
- return $x;
+ return $x;
}
function f3(namespace\foo $x) {
- return "ok\n";
+ return "ok\n";
}
echo namespace\C;
@@ -56,7 +56,7 @@ const ok
class ok
ok
-Fatal error: Uncaught Error: Undefined constant 'Test\ns1\unknown' in %sns_057.php:%d
+Fatal error: Uncaught Error: Undefined constant "Test\ns1\unknown" in %s:%d
Stack trace:
#0 {main}
thrown in %sns_057.php on line %d
diff --git a/Zend/tests/ns_058.phpt b/Zend/tests/ns_058.phpt
index 54e84aa030..0c0b19760d 100644
--- a/Zend/tests/ns_058.phpt
+++ b/Zend/tests/ns_058.phpt
@@ -5,30 +5,30 @@
const C = "const ok\n";
function foo() {
- return "func ok\n";
+ return "func ok\n";
}
class foo {
- const C = "const ok\n";
- const C2 = namespace\C;
- static $var = "var ok\n";
- function __construct() {
- echo "class ok\n";
- }
- static function bar() {
- return "method ok\n";
- }
+ const C = "const ok\n";
+ const C2 = namespace\C;
+ static $var = "var ok\n";
+ function __construct() {
+ echo "class ok\n";
+ }
+ static function bar() {
+ return "method ok\n";
+ }
}
function f1($x=namespace\C) {
- return $x;
+ return $x;
}
function f2($x=namespace\foo::C) {
- return $x;
+ return $x;
}
function f3(namespace\foo $x) {
- return "ok\n";
+ return "ok\n";
}
echo namespace\C;
@@ -54,7 +54,7 @@ const ok
class ok
ok
-Fatal error: Uncaught Error: Undefined constant 'unknown' in %sns_058.php:%d
+Fatal error: Uncaught Error: Undefined constant "unknown" in %s:%d
Stack trace:
#0 {main}
thrown in %sns_058.php on line %d
diff --git a/Zend/tests/ns_059.phpt b/Zend/tests/ns_059.phpt
index 87f1ea2ac9..c6aabb583c 100644
--- a/Zend/tests/ns_059.phpt
+++ b/Zend/tests/ns_059.phpt
@@ -4,6 +4,7 @@
<?php
const C = array();
var_dump(C);
+?>
--EXPECT--
array(0) {
}
diff --git a/Zend/tests/ns_060.phpt b/Zend/tests/ns_060.phpt
index 16c8024f00..fac600fd7d 100644
--- a/Zend/tests/ns_060.phpt
+++ b/Zend/tests/ns_060.phpt
@@ -16,6 +16,7 @@ $b = new A;
echo get_class($a)."\n";
echo get_class($b)."\n";
class A {}
+?>
--EXPECT--
Bar\A
Foo\A
diff --git a/Zend/tests/ns_061.phpt b/Zend/tests/ns_061.phpt
index 948f675d6d..ecd3ccea1c 100644
--- a/Zend/tests/ns_061.phpt
+++ b/Zend/tests/ns_061.phpt
@@ -5,5 +5,6 @@
class A {}
use \A as B;
echo get_class(new B)."\n";
+?>
--EXPECT--
A
diff --git a/Zend/tests/ns_062.phpt b/Zend/tests/ns_062.phpt
index d795da4c68..89d0581ae6 100644
--- a/Zend/tests/ns_062.phpt
+++ b/Zend/tests/ns_062.phpt
@@ -7,6 +7,7 @@ use \stdClass;
use \stdClass as A;
echo get_class(new stdClass)."\n";
echo get_class(new A)."\n";
+?>
--EXPECT--
stdClass
stdClass
diff --git a/Zend/tests/ns_063.phpt b/Zend/tests/ns_063.phpt
index dbe34b428e..625a499fa2 100644
--- a/Zend/tests/ns_063.phpt
+++ b/Zend/tests/ns_063.phpt
@@ -4,9 +4,9 @@
<?php
namespace Foo;
class Bar {
- function Bar() {
- echo "ok\n";
- }
+ function Bar() {
+ echo "ok\n";
+ }
}
new Bar();
echo "ok\n";
diff --git a/Zend/tests/ns_064.phpt b/Zend/tests/ns_064.phpt
index 546d3f6375..97e76ed612 100644
--- a/Zend/tests/ns_064.phpt
+++ b/Zend/tests/ns_064.phpt
@@ -6,19 +6,19 @@ Magic methods in overridden stdClass inside namespace
namespace test;
class foo {
- public $e = array();
+ public $e = array();
- public function __construct() {
- $this->e[] = $this;
- }
+ public function __construct() {
+ $this->e[] = $this;
+ }
- public function __set($a, $b) {
- var_dump($a, $b);
- }
- public function __get($a) {
- var_dump($a);
- return $this;
- }
+ public function __set($a, $b) {
+ var_dump($a, $b);
+ }
+ public function __get($a) {
+ var_dump($a);
+ return $this;
+ }
}
use test\foo as stdClass;
diff --git a/Zend/tests/ns_065.inc b/Zend/tests/ns_065.inc
index 963a74e140..4bc1f6f819 100644
--- a/Zend/tests/ns_065.inc
+++ b/Zend/tests/ns_065.inc
@@ -1,9 +1,9 @@
<?php
namespace X\Y;
function foo() {
- echo __FUNCTION__."\n";
+ echo __FUNCTION__."\n";
}
namespace X\Z;
function foo() {
- echo __FUNCTION__."\n";
+ echo __FUNCTION__."\n";
}
diff --git a/Zend/tests/ns_065.phpt b/Zend/tests/ns_065.phpt
index 40ccd1e153..d8a0d641fe 100644
--- a/Zend/tests/ns_065.phpt
+++ b/Zend/tests/ns_065.phpt
@@ -8,6 +8,7 @@ require "ns_065.inc";
test\foo();
test2\foo();
+?>
--EXPECT--
X\Y\foo
X\Z\foo
diff --git a/Zend/tests/ns_066.phpt b/Zend/tests/ns_066.phpt
index 881589cf2c..8ec5c222ab 100644
--- a/Zend/tests/ns_066.phpt
+++ b/Zend/tests/ns_066.phpt
@@ -6,5 +6,6 @@ include __DIR__ . '/ns_027.inc';
use Foo\Bar\Foo as stdClass;
new stdClass();
+?>
--EXPECT--
Foo\Bar\Foo
diff --git a/Zend/tests/ns_067.phpt b/Zend/tests/ns_067.phpt
index b94eb30ead..73a9390b40 100644
--- a/Zend/tests/ns_067.phpt
+++ b/Zend/tests/ns_067.phpt
@@ -5,5 +5,6 @@
include __DIR__ . '/ns_022.inc';
include __DIR__ . '/ns_027.inc';
include __DIR__ . '/ns_067.inc';
+?>
--EXPECT--
Foo\Bar\Foo
diff --git a/Zend/tests/ns_069.phpt b/Zend/tests/ns_069.phpt
index cbfb927049..19b6fe8c2b 100644
--- a/Zend/tests/ns_069.phpt
+++ b/Zend/tests/ns_069.phpt
@@ -16,9 +16,7 @@ class Test {
Test::f();
?>
-===DONE===
--EXPECT--
string(3) "foo"
string(0) ""
string(3) "foo"
-===DONE===
diff --git a/Zend/tests/ns_070.phpt b/Zend/tests/ns_070.phpt
index 37cb6a0068..9c0e06abff 100644
--- a/Zend/tests/ns_070.phpt
+++ b/Zend/tests/ns_070.phpt
@@ -6,9 +6,9 @@ Testing parameter type-hinted with default value inside namespace
namespace foo;
class bar {
- public function __construct(\stdclass $x = NULL) {
- var_dump($x);
- }
+ public function __construct(\stdclass $x = NULL) {
+ var_dump($x);
+ }
}
new bar(new \stdclass);
diff --git a/Zend/tests/ns_071.phpt b/Zend/tests/ns_071.phpt
index d7f1592b38..18e5a745d5 100644
--- a/Zend/tests/ns_071.phpt
+++ b/Zend/tests/ns_071.phpt
@@ -6,9 +6,9 @@ Testing parameter type-hinted (array) with default value inside namespace
namespace foo;
class bar {
- public function __construct(array $x = NULL) {
- var_dump($x);
- }
+ public function __construct(array $x = NULL) {
+ var_dump($x);
+ }
}
new bar(null);
@@ -18,7 +18,7 @@ new bar(new \stdclass);
--EXPECTF--
NULL
-Fatal error: Uncaught TypeError: Argument 1 passed to foo\bar::__construct() must be of the type array or null, object given, called in %s on line %d and defined in %s:%d
+Fatal error: Uncaught TypeError: foo\bar::__construct(): Argument #1 ($x) must be of type ?array, stdClass given, called in %s:%d
Stack trace:
#0 %s(%d): foo\bar->__construct(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/ns_072.phpt b/Zend/tests/ns_072.phpt
index 932a38b3ba..b41fe29778 100644
--- a/Zend/tests/ns_072.phpt
+++ b/Zend/tests/ns_072.phpt
@@ -10,9 +10,9 @@ interface foo {
}
class bar {
- public function __construct(foo $x = NULL) {
- var_dump($x);
- }
+ public function __construct(foo $x = NULL) {
+ var_dump($x);
+ }
}
class test implements foo {
@@ -30,7 +30,7 @@ object(foo\test)#%d (0) {
}
NULL
-Fatal error: Uncaught TypeError: Argument 1 passed to foo\bar::__construct() must implement interface foo\foo or be null, instance of stdClass given, called in %s on line %d and defined in %s:%d
+Fatal error: Uncaught TypeError: foo\bar::__construct(): Argument #1 ($x) must be of type ?foo\foo, stdClass given, called in %s:%d
Stack trace:
#0 %s(%d): foo\bar->__construct(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/ns_073.phpt b/Zend/tests/ns_073.phpt
index 8f083195d5..a3a9137e76 100644
--- a/Zend/tests/ns_073.phpt
+++ b/Zend/tests/ns_073.phpt
@@ -6,7 +6,7 @@ Testing type-hinted lambda parameter inside namespace
namespace foo;
$x = function (\stdclass $x = NULL) {
- var_dump($x);
+ var_dump($x);
};
$x(NULL);
diff --git a/Zend/tests/ns_074.phpt b/Zend/tests/ns_074.phpt
index 9fd8699aec..37d4e7dc3a 100644
--- a/Zend/tests/ns_074.phpt
+++ b/Zend/tests/ns_074.phpt
@@ -6,7 +6,7 @@ Testing type-hinted lambda parameter inside namespace
namespace foo;
$x = function (\stdclass $x = NULL) {
- var_dump($x);
+ var_dump($x);
};
class stdclass extends \stdclass { }
diff --git a/Zend/tests/ns_075.phpt b/Zend/tests/ns_075.phpt
index 0156e99eb4..617e7777ff 100644
--- a/Zend/tests/ns_075.phpt
+++ b/Zend/tests/ns_075.phpt
@@ -6,5 +6,6 @@ namespace foo;
const NULL = 1;
echo NULL;
+?>
--EXPECTF--
Fatal error: Cannot redeclare constant 'NULL' in %sns_075.php on line %d
diff --git a/Zend/tests/ns_076.phpt b/Zend/tests/ns_076.phpt
index ea97e924b1..230b498b54 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/ns_077_1.phpt b/Zend/tests/ns_077_1.phpt
index b59f8172ea..bbd39bd4bf 100644
--- a/Zend/tests/ns_077_1.phpt
+++ b/Zend/tests/ns_077_1.phpt
@@ -9,8 +9,9 @@ function foo($a = array(0 => \unknown))
}
foo();
+?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'unknown' in %sns_077_%d.php:%d
+Fatal error: Uncaught Error: Undefined constant "unknown" in %s:%d
Stack trace:
#0 %s(%d): foo\foo()
#1 {main}
diff --git a/Zend/tests/ns_077_2.phpt b/Zend/tests/ns_077_2.phpt
index d51350c56a..6b2b297ef6 100644
--- a/Zend/tests/ns_077_2.phpt
+++ b/Zend/tests/ns_077_2.phpt
@@ -9,8 +9,9 @@ function foo($a = array(\unknown => unknown))
}
foo();
+?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'unknown' in %sns_077_%d.php:%d
+Fatal error: Uncaught Error: Undefined constant "unknown" in %s:%d
Stack trace:
#0 %s(%d): foo\foo()
#1 {main}
diff --git a/Zend/tests/ns_077_3.phpt b/Zend/tests/ns_077_3.phpt
index 0e90195c05..4f3834acaa 100644
--- a/Zend/tests/ns_077_3.phpt
+++ b/Zend/tests/ns_077_3.phpt
@@ -9,8 +9,9 @@ function foo($a = array(namespace\unknown => unknown))
}
foo();
+?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'foo\unknown' in %sns_077_%d.php:%d
+Fatal error: Uncaught Error: Undefined constant "foo\unknown" in %s:%d
Stack trace:
#0 %s(%d): foo\foo()
#1 {main}
diff --git a/Zend/tests/ns_077_4.phpt b/Zend/tests/ns_077_4.phpt
index 72c3233a63..74c2d9eae7 100644
--- a/Zend/tests/ns_077_4.phpt
+++ b/Zend/tests/ns_077_4.phpt
@@ -9,8 +9,9 @@ function foo($a = array(0 => namespace\unknown))
}
foo();
+?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'foo\unknown' in %sns_077_%d.php:%d
+Fatal error: Uncaught Error: Undefined constant "foo\unknown" in %s:%d
Stack trace:
#0 %s(%d): foo\foo()
#1 {main}
diff --git a/Zend/tests/ns_077_5.phpt b/Zend/tests/ns_077_5.phpt
index 05235442e5..8ea77a8dab 100644
--- a/Zend/tests/ns_077_5.phpt
+++ b/Zend/tests/ns_077_5.phpt
@@ -8,8 +8,9 @@ function foo($a = array(0 => \unknown))
}
foo();
+?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'unknown' in %sns_077_%d.php:%d
+Fatal error: Uncaught Error: Undefined constant "unknown" in %s:%d
Stack trace:
#0 %s(%d): foo()
#1 {main}
diff --git a/Zend/tests/ns_077_7.phpt b/Zend/tests/ns_077_7.phpt
index 166bf31cc7..43a647c608 100644
--- a/Zend/tests/ns_077_7.phpt
+++ b/Zend/tests/ns_077_7.phpt
@@ -8,8 +8,9 @@ function foo($a = array(0 => namespace\unknown))
}
foo();
+?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'unknown' in %sns_077_%d.php:%d
+Fatal error: Uncaught Error: Undefined constant "unknown" in %s:%d
Stack trace:
#0 %s(%d): foo()
#1 {main}
diff --git a/Zend/tests/ns_077_8.phpt b/Zend/tests/ns_077_8.phpt
index e081842460..9c1bc1db84 100644
--- a/Zend/tests/ns_077_8.phpt
+++ b/Zend/tests/ns_077_8.phpt
@@ -8,8 +8,9 @@ function foo($a = array(namespace\unknown => unknown))
}
foo();
+?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'unknown' in %sns_077_%d.php:%d
+Fatal error: Uncaught Error: Undefined constant "unknown" in %s:%d
Stack trace:
#0 %s(%d): foo()
#1 {main}
diff --git a/Zend/tests/ns_078.phpt b/Zend/tests/ns_078.phpt
index ed6770ff47..cbb823743b 100644
--- a/Zend/tests/ns_078.phpt
+++ b/Zend/tests/ns_078.phpt
@@ -26,6 +26,7 @@ Foo::bar();
Bar::bar();
Foo2::bar();
Bar2::bar();
+?>
--EXPECT--
test\ns1\Foo
test\ns1\Foo
diff --git a/Zend/tests/ns_081.phpt b/Zend/tests/ns_081.phpt
index e08a8088e0..071cc986c9 100644
--- a/Zend/tests/ns_081.phpt
+++ b/Zend/tests/ns_081.phpt
@@ -5,13 +5,13 @@
namespace foo {
use \foo;
class bar {
- function __construct() {echo __METHOD__,"\n";}
+ function __construct() {echo __METHOD__,"\n";}
}
new foo;
new bar;
namespace oops;
class foo {
- function __construct() {echo __METHOD__,"\n";}
+ function __construct() {echo __METHOD__,"\n";}
}
use foo\bar as foo1;
new foo1;
diff --git a/Zend/tests/ns_084.phpt b/Zend/tests/ns_084.phpt
index cb1ae55e28..4fda7819ae 100644
--- a/Zend/tests/ns_084.phpt
+++ b/Zend/tests/ns_084.phpt
@@ -5,13 +5,13 @@
namespace foo;
use \foo;
class bar {
- function __construct() {echo __METHOD__,"\n";}
+ function __construct() {echo __METHOD__,"\n";}
}
new foo;
new bar;
namespace oops {
class foo {
- function __construct() {echo __METHOD__,"\n";}
+ function __construct() {echo __METHOD__,"\n";}
}
use foo\bar as foo1;
new foo1;
diff --git a/Zend/tests/ns_085.phpt b/Zend/tests/ns_085.phpt
index 7755d809e3..806c9dbcfc 100644
--- a/Zend/tests/ns_085.phpt
+++ b/Zend/tests/ns_085.phpt
@@ -5,20 +5,21 @@
namespace foo {
use \foo;
class bar {
- function __construct() {echo __METHOD__,"\n";}
+ function __construct() {echo __METHOD__,"\n";}
}
new foo;
new bar;
}
namespace {
class foo {
- function __construct() {echo __METHOD__,"\n";}
+ function __construct() {echo __METHOD__,"\n";}
}
use foo\bar as foo1;
new foo1;
new foo;
echo "===DONE===\n";
}
+?>
--EXPECT--
foo::__construct
foo\bar::__construct
diff --git a/Zend/tests/ns_086.phpt b/Zend/tests/ns_086.phpt
index ed4b8a238c..c87f1b72d4 100644
--- a/Zend/tests/ns_086.phpt
+++ b/Zend/tests/ns_086.phpt
@@ -14,20 +14,21 @@ declare(encoding='utf-8');
namespace foo {
use \foo;
class bar {
- function __construct() {echo __METHOD__,"\n";}
+ function __construct() {echo __METHOD__,"\n";}
}
new foo;
new bar;
}
namespace {
class foo {
- function __construct() {echo __METHOD__,"\n";}
+ function __construct() {echo __METHOD__,"\n";}
}
use foo\bar as foo1;
new foo1;
new foo;
echo "===DONE===\n";
}
+?>
--EXPECT--
foo::__construct
foo\bar::__construct
diff --git a/Zend/tests/ns_087.phpt b/Zend/tests/ns_087.phpt
index b2f0a89b22..807e72afb1 100644
--- a/Zend/tests/ns_087.phpt
+++ b/Zend/tests/ns_087.phpt
@@ -5,7 +5,7 @@
namespace foo {
use \foo;
class bar {
- function __construct() {echo __METHOD__,"\n";}
+ function __construct() {echo __METHOD__,"\n";}
}
new foo;
new bar;
@@ -13,12 +13,13 @@ new bar;
$a = 'oops';
namespace {
class foo {
- function __construct() {echo __METHOD__,"\n";}
+ function __construct() {echo __METHOD__,"\n";}
}
use foo\bar as foo1;
new foo1;
new foo;
echo "===DONE===\n";
}
+?>
--EXPECTF--
Fatal error: No code may exist outside of namespace {} in %s on line 10
diff --git a/Zend/tests/ns_088.phpt b/Zend/tests/ns_088.phpt
index 18210da6df..01ea1175c0 100644
--- a/Zend/tests/ns_088.phpt
+++ b/Zend/tests/ns_088.phpt
@@ -14,4 +14,4 @@ namespace Fiz\Biz\Buz {
}
?>
--EXPECTF--
-Parse error: syntax error, unexpected '{', expecting '}' in %sns_088.php on line 5
+Parse error: syntax error, unexpected token "{", expecting "}" in %s on line %d
diff --git a/Zend/tests/ns_089.phpt b/Zend/tests/ns_089.phpt
index 71c6b74a9b..1ea725c344 100644
--- a/Zend/tests/ns_089.phpt
+++ b/Zend/tests/ns_089.phpt
@@ -42,6 +42,7 @@ namespace Fiz\Biz\Buz {
var_dump(BOZ);
var_dump(BAR);
}
+?>
--EXPECT--
Foo\Bar\Baz\A::__construct
Foo\Bar\Baz\B::__construct
diff --git a/Zend/tests/ns_090.phpt b/Zend/tests/ns_090.phpt
index 166828c8cb..2e1eb71cae 100644
--- a/Zend/tests/ns_090.phpt
+++ b/Zend/tests/ns_090.phpt
@@ -33,6 +33,7 @@ namespace Fiz\Biz\Buz {
var_dump(BOZ);
var_dump(BAR);
}
+?>
--EXPECT--
Foo\Bar\Baz\A::__construct
Foo\Bar\Baz\B::__construct
diff --git a/Zend/tests/ns_091.phpt b/Zend/tests/ns_091.phpt
index ee979025d2..440eaaa356 100644
--- a/Zend/tests/ns_091.phpt
+++ b/Zend/tests/ns_091.phpt
@@ -14,6 +14,7 @@ namespace Fiz\Biz\Buz {
new A;
new B;
}
+?>
--EXPECT--
Foo\Bar\A::__construct
Foo\Bar\Baz\B::__construct
diff --git a/Zend/tests/ns_092.phpt b/Zend/tests/ns_092.phpt
index 5618080022..f16eeece89 100644
--- a/Zend/tests/ns_092.phpt
+++ b/Zend/tests/ns_092.phpt
@@ -47,6 +47,7 @@ namespace Fiz\Biz\Buz {
boz();
A();
}
+?>
--EXPECTF--
==== MIXED ====
Foo\Bar\A::__construct
diff --git a/Zend/tests/ns_093.phpt b/Zend/tests/ns_093.phpt
index 4452a6e175..204978d603 100644
--- a/Zend/tests/ns_093.phpt
+++ b/Zend/tests/ns_093.phpt
@@ -20,5 +20,6 @@ use Foo\Bar\
};
echo "\nDone\n";
+?>
--EXPECT--
Done
diff --git a/Zend/tests/ns_094.phpt b/Zend/tests/ns_094.phpt
index a809437a1b..03b8f62885 100644
--- a/Zend/tests/ns_094.phpt
+++ b/Zend/tests/ns_094.phpt
@@ -1,5 +1,5 @@
--TEST--
-Type group use declarations should not allow override on inner itens
+Type group use declarations should not allow override on inner items
--FILE--
<?php
@@ -10,5 +10,6 @@ use const Foo\Bar\{
const B,
function C
};
+?>
--EXPECTF--
-Parse error: syntax error, unexpected 'const' (T_CONST), expecting '}' in %s on line 7
+Parse error: syntax error, unexpected token "const", expecting "}" in %s on line %d
diff --git a/Zend/tests/ns_096.phpt b/Zend/tests/ns_096.phpt
index 48f0c75387..03b09047ff 100644
--- a/Zend/tests/ns_096.phpt
+++ b/Zend/tests/ns_096.phpt
@@ -7,4 +7,4 @@ use Foo\Bar\{\Baz};
?>
--EXPECTF--
-Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting identifier (T_STRING) or function (T_FUNCTION) or const (T_CONST) in %s on line 3
+Parse error: syntax error, unexpected fully qualified name "\Baz", expecting identifier or namespaced name or "function" or "const" in %s on line %d
diff --git a/Zend/tests/ns_trailing_comma_error_01.phpt b/Zend/tests/ns_trailing_comma_error_01.phpt
index 1b226036cf..f8fa5dbf12 100644
--- a/Zend/tests/ns_trailing_comma_error_01.phpt
+++ b/Zend/tests/ns_trailing_comma_error_01.phpt
@@ -5,4 +5,4 @@ Group use declarations mustn't be empty
use Baz\{};
?>
--EXPECTF--
-Parse error: syntax error, unexpected '}', expecting identifier (T_STRING) or function (T_FUNCTION) or const (T_CONST) in %s on line %d
+Parse error: syntax error, unexpected token "}", expecting identifier or namespaced name or "function" or "const" in %s on line %d
diff --git a/Zend/tests/ns_trailing_comma_error_02.phpt b/Zend/tests/ns_trailing_comma_error_02.phpt
index c2123a85f5..f73ffe748d 100644
--- a/Zend/tests/ns_trailing_comma_error_02.phpt
+++ b/Zend/tests/ns_trailing_comma_error_02.phpt
@@ -5,4 +5,4 @@ Group use declarations mustn't contain just a comma
use Baz\{,};
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',', expecting identifier (T_STRING) or function (T_FUNCTION) or const (T_CONST) in %s on line %d
+Parse error: syntax error, unexpected token ",", expecting identifier or namespaced name or "function" or "const" in %s on line %d
diff --git a/Zend/tests/ns_trailing_comma_error_03.phpt b/Zend/tests/ns_trailing_comma_error_03.phpt
index a07720becc..3455f55533 100644
--- a/Zend/tests/ns_trailing_comma_error_03.phpt
+++ b/Zend/tests/ns_trailing_comma_error_03.phpt
@@ -5,4 +5,4 @@ Group use declarations mustn't allow more than one comma
use Baz\{Foo,,};
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',', expecting '}' in %s on line %d
+Parse error: syntax error, unexpected token ",", expecting "}" in %s on line %d
diff --git a/Zend/tests/ns_trailing_comma_error_04.phpt b/Zend/tests/ns_trailing_comma_error_04.phpt
index 09d7ebf349..18bbea745a 100644
--- a/Zend/tests/ns_trailing_comma_error_04.phpt
+++ b/Zend/tests/ns_trailing_comma_error_04.phpt
@@ -5,4 +5,4 @@ Group use declarations mustn't begin with a comma
use Baz\{,Foo};
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',', expecting identifier (T_STRING) or function (T_FUNCTION) or const (T_CONST) in %s on line %d
+Parse error: syntax error, unexpected token ",", expecting identifier or namespaced name or "function" or "const" in %s on line %d
diff --git a/Zend/tests/ns_trailing_comma_error_05.phpt b/Zend/tests/ns_trailing_comma_error_05.phpt
index d748747a03..93cb93964b 100644
--- a/Zend/tests/ns_trailing_comma_error_05.phpt
+++ b/Zend/tests/ns_trailing_comma_error_05.phpt
@@ -5,4 +5,4 @@ Group use declarations mustn't contain two commas mid-list
use Baz\{Foo,,Bar};
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',', expecting '}' in %s on line %d
+Parse error: syntax error, unexpected token ",", expecting "}" in %s on line %d
diff --git a/Zend/tests/ns_trailing_comma_error_06.phpt b/Zend/tests/ns_trailing_comma_error_06.phpt
index 8d8b759a5a..2547a6f027 100644
--- a/Zend/tests/ns_trailing_comma_error_06.phpt
+++ b/Zend/tests/ns_trailing_comma_error_06.phpt
@@ -5,4 +5,4 @@ Unmixed group use declarations mustn't allow more than one comma
use const Baz\{Foo,,};
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',', expecting '}' in %s on line %d
+Parse error: syntax error, unexpected token ",", expecting "}" in %s on line %d
diff --git a/Zend/tests/ns_trailing_comma_error_07.phpt b/Zend/tests/ns_trailing_comma_error_07.phpt
index e925a60de8..c7798da8f0 100644
--- a/Zend/tests/ns_trailing_comma_error_07.phpt
+++ b/Zend/tests/ns_trailing_comma_error_07.phpt
@@ -5,4 +5,4 @@ Unmixed group use declarations mustn't begin with a comma
use function Baz\{,Foo};
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',', expecting identifier (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected token ",", expecting identifier or namespaced name in %s on line %d
diff --git a/Zend/tests/ns_trailing_comma_error_08.phpt b/Zend/tests/ns_trailing_comma_error_08.phpt
index b3804aeb76..287f35d2eb 100644
--- a/Zend/tests/ns_trailing_comma_error_08.phpt
+++ b/Zend/tests/ns_trailing_comma_error_08.phpt
@@ -5,4 +5,4 @@ Unmixed group use declarations mustn't contain two commas mid-list
use const Baz\{Foo,,Bar};
?>
--EXPECTF--
-Parse error: syntax error, unexpected ',', expecting '}' in %s on line %d
+Parse error: syntax error, unexpected token ",", expecting "}" in %s on line %d
diff --git a/Zend/tests/nullable_types/array.phpt b/Zend/tests/nullable_types/array.phpt
index 6ee89b3962..0cacf0ba2e 100644
--- a/Zend/tests/nullable_types/array.phpt
+++ b/Zend/tests/nullable_types/array.phpt
@@ -9,6 +9,7 @@ function _array_(?array $v): ?array {
var_dump(_array_(null));
var_dump(_array_([]));
+?>
--EXPECT--
NULL
array(0) {
diff --git a/Zend/tests/nullable_types/contravariant_nullable_param_succeeds.phpt b/Zend/tests/nullable_types/contravariant_nullable_param_succeeds.phpt
index a618ed2073..ab4b5b2d9e 100644
--- a/Zend/tests/nullable_types/contravariant_nullable_param_succeeds.phpt
+++ b/Zend/tests/nullable_types/contravariant_nullable_param_succeeds.phpt
@@ -13,4 +13,5 @@ class B implements A {
$b = new B();
$b->method(null);
+?>
--EXPECT--
diff --git a/Zend/tests/nullable_types/contravariant_nullable_return_fails.phpt b/Zend/tests/nullable_types/contravariant_nullable_return_fails.phpt
index fe6ebc5654..0f9c0655cd 100644
--- a/Zend/tests/nullable_types/contravariant_nullable_return_fails.phpt
+++ b/Zend/tests/nullable_types/contravariant_nullable_return_fails.phpt
@@ -10,5 +10,6 @@ interface A {
interface B extends A {
function method(): ?int;
}
+?>
--EXPECTF--
Fatal error: Declaration of B::method(): ?int must be compatible with A::method(): int in %s on line %d
diff --git a/Zend/tests/nullable_types/covariant_nullable_param_fails.phpt b/Zend/tests/nullable_types/covariant_nullable_param_fails.phpt
index 015f540ac0..f1506fa046 100644
--- a/Zend/tests/nullable_types/covariant_nullable_param_fails.phpt
+++ b/Zend/tests/nullable_types/covariant_nullable_param_fails.phpt
@@ -10,5 +10,6 @@ interface A {
class B implements A {
function method(int $p) { }
}
+?>
--EXPECTF--
Fatal error: Declaration of B::method(int $p) must be compatible with A::method(?int $p) in %s on line %d
diff --git a/Zend/tests/nullable_types/covariant_nullable_return_succeds.phpt b/Zend/tests/nullable_types/covariant_nullable_return_succeds.phpt
index 9251d3b4c1..76eef7d692 100644
--- a/Zend/tests/nullable_types/covariant_nullable_return_succeds.phpt
+++ b/Zend/tests/nullable_types/covariant_nullable_return_succeds.phpt
@@ -10,4 +10,5 @@ interface A {
interface B extends A {
function method(): int;
}
+?>
--EXPECT--
diff --git a/Zend/tests/nullable_types/float.phpt b/Zend/tests/nullable_types/float.phpt
index 0c6602109f..14af7a6864 100644
--- a/Zend/tests/nullable_types/float.phpt
+++ b/Zend/tests/nullable_types/float.phpt
@@ -9,6 +9,7 @@ function _float_(?float $v): ?float {
var_dump(_float_(null));
var_dump(_float_(1.3));
+?>
--EXPECT--
NULL
float(1.3)
diff --git a/Zend/tests/nullable_types/int.phpt b/Zend/tests/nullable_types/int.phpt
index b5bafb0956..0553c05221 100644
--- a/Zend/tests/nullable_types/int.phpt
+++ b/Zend/tests/nullable_types/int.phpt
@@ -9,6 +9,7 @@ function _int_(?int $v): ?int {
var_dump(_int_(null));
var_dump(_int_(1));
+?>
--EXPECT--
NULL
int(1)
diff --git a/Zend/tests/nullable_types/invariant_param_and_return_succeeds.phpt b/Zend/tests/nullable_types/invariant_param_and_return_succeeds.phpt
index 6ddad67bb8..6df4d506cf 100644
--- a/Zend/tests/nullable_types/invariant_param_and_return_succeeds.phpt
+++ b/Zend/tests/nullable_types/invariant_param_and_return_succeeds.phpt
@@ -16,6 +16,7 @@ class B implements A {
$b = new B();
var_dump($b->method(null));
var_dump($b->method(1));
+?>
--EXPECT--
NULL
int(1)
diff --git a/Zend/tests/nullable_types/nullable_type_parameters_do_not_have_default_value.phpt b/Zend/tests/nullable_types/nullable_type_parameters_do_not_have_default_value.phpt
index 95442b96b4..e7f6add6f5 100644
--- a/Zend/tests/nullable_types/nullable_type_parameters_do_not_have_default_value.phpt
+++ b/Zend/tests/nullable_types/nullable_type_parameters_do_not_have_default_value.phpt
@@ -6,6 +6,7 @@ Explicit nullable types do not imply a default value
function f(?callable $p) {}
f();
+?>
--EXPECTF--
Fatal error: Uncaught ArgumentCountError: Too few arguments to function f(), 0 passed in %snullable_type_parameters_do_not_have_default_value.php on line %d and exactly 1 expected in %s:%d
Stack trace:
diff --git a/Zend/tests/nullable_types/string.phpt b/Zend/tests/nullable_types/string.phpt
index ab469af808..2973b55690 100644
--- a/Zend/tests/nullable_types/string.phpt
+++ b/Zend/tests/nullable_types/string.phpt
@@ -9,6 +9,7 @@ function _string_(?string $v): ?string {
var_dump(_string_(null));
var_dump(_string_("php"));
+?>
--EXPECT--
NULL
string(3) "php"
diff --git a/Zend/tests/nullable_types/union_nullable_property_fails.phpt b/Zend/tests/nullable_types/union_nullable_property_fails.phpt
new file mode 100644
index 0000000000..809f7d3032
--- /dev/null
+++ b/Zend/tests/nullable_types/union_nullable_property_fails.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Nullable default property error message
+--FILE--
+<?php
+
+class A {
+ public string|int $b = null;
+}
+
+$t = new A;
+$t->b;
+
+?>
+--EXPECTF--
+Fatal error: Default value for property of type string|int may not be null. Use the nullable type string|int|null to allow null default value in %s on line %d
diff --git a/Zend/tests/nullsafe_operator/001.phpt b/Zend/tests/nullsafe_operator/001.phpt
new file mode 100644
index 0000000000..22776006a7
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/001.phpt
@@ -0,0 +1,106 @@
+--TEST--
+Test basic nullsafe method calls
+--FILE--
+<?php
+
+class Foo {
+ function null() {
+ var_dump('Foo::null()');
+ return null;
+ }
+
+ function self() {
+ var_dump('Foo::self()');
+ return $this;
+ }
+}
+
+var_dump(null?->bar());
+var_dump(null?->bar(var_dump('Not executed')));
+var_dump(null?->bar()->baz());
+var_dump(null?->bar()->baz(var_dump('Not executed')));
+var_dump(null?->bar()->baz);
+var_dump(null?->bar()::$baz);
+var_dump(null?->bar()::baz());
+
+$foo = new Foo();
+var_dump($foo->null()?->bar());
+var_dump($foo->null()?->bar(var_dump('Not executed')));
+var_dump($foo->null()?->bar()->baz());
+var_dump($foo->null()?->bar()->baz(var_dump('Not executed')));
+var_dump($foo->null()?->bar()->baz);
+var_dump($foo->null()?->bar()::$baz);
+var_dump($foo->null()?->bar()::baz());
+
+$foo = new Foo();
+var_dump($foo?->self(var_dump('Executed'))->null()?->bar());
+var_dump($foo?->self(var_dump('Executed'))->null()?->bar(var_dump('Not executed')));
+var_dump($foo?->self(var_dump('Executed'))->null()?->bar()->baz());
+var_dump($foo?->self(var_dump('Executed'))->null()?->bar()->baz(var_dump('Not executed')));
+var_dump($foo?->self(var_dump('Executed'))->null()?->bar()->baz);
+var_dump($foo?->self(var_dump('Executed'))->null()?->bar()::$baz);
+var_dump($foo?->self(var_dump('Executed'))->null()?->bar()::baz());
+
+var_dump($foo->self(null?->bar())->null());
+try {
+ var_dump($foo?->self()[null?->bar()]);
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECT--
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+string(11) "Foo::null()"
+NULL
+string(11) "Foo::null()"
+NULL
+string(11) "Foo::null()"
+NULL
+string(11) "Foo::null()"
+NULL
+string(11) "Foo::null()"
+NULL
+string(11) "Foo::null()"
+NULL
+string(11) "Foo::null()"
+NULL
+string(8) "Executed"
+string(11) "Foo::self()"
+string(11) "Foo::null()"
+NULL
+string(8) "Executed"
+string(11) "Foo::self()"
+string(11) "Foo::null()"
+NULL
+string(8) "Executed"
+string(11) "Foo::self()"
+string(11) "Foo::null()"
+NULL
+string(8) "Executed"
+string(11) "Foo::self()"
+string(11) "Foo::null()"
+NULL
+string(8) "Executed"
+string(11) "Foo::self()"
+string(11) "Foo::null()"
+NULL
+string(8) "Executed"
+string(11) "Foo::self()"
+string(11) "Foo::null()"
+NULL
+string(8) "Executed"
+string(11) "Foo::self()"
+string(11) "Foo::null()"
+NULL
+string(11) "Foo::self()"
+string(11) "Foo::null()"
+NULL
+string(11) "Foo::self()"
+string(38) "Cannot use object of type Foo as array"
diff --git a/Zend/tests/nullsafe_operator/002.phpt b/Zend/tests/nullsafe_operator/002.phpt
new file mode 100644
index 0000000000..46c1bb623f
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/002.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test nullsafe strict type check
+--FILE--
+<?php
+
+try {
+ false?->bar();
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ []?->bar();
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ (0)?->bar();
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ (0.0)?->bar();
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ ''?->bar();
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECT--
+string(39) "Call to a member function bar() on bool"
+string(40) "Call to a member function bar() on array"
+string(38) "Call to a member function bar() on int"
+string(40) "Call to a member function bar() on float"
+string(41) "Call to a member function bar() on string"
diff --git a/Zend/tests/nullsafe_operator/003.phpt b/Zend/tests/nullsafe_operator/003.phpt
new file mode 100644
index 0000000000..83c2863d1a
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/003.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test basic nullsafe property fetching
+--FILE--
+<?php
+
+class Foo {
+ public $bar = 'bar';
+
+ function qux() {
+ return 'qux';
+ }
+}
+
+$null = null;
+$foo = new Foo();
+
+var_dump(null?->bar);
+var_dump(null?->baz);
+var_dump(null?->qux());
+var_dump(null?->quux());
+
+var_dump($foo?->bar);
+var_dump($foo?->baz);
+var_dump($foo?->qux());
+try {
+ var_dump($foo?->quux());
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+var_dump((new Foo)?->bar);
+var_dump((new Foo)?->baz);
+var_dump((new Foo)?->qux());
+try {
+ var_dump((new Foo)?->quux());
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+NULL
+NULL
+NULL
+NULL
+string(3) "bar"
+
+Warning: Undefined property: Foo::$baz in %s.php on line 20
+NULL
+string(3) "qux"
+string(36) "Call to undefined method Foo::quux()"
+string(3) "bar"
+
+Warning: Undefined property: Foo::$baz in %s.php on line 29
+NULL
+string(3) "qux"
+string(36) "Call to undefined method Foo::quux()"
diff --git a/Zend/tests/nullsafe_operator/004.phpt b/Zend/tests/nullsafe_operator/004.phpt
new file mode 100644
index 0000000000..0dc95d3f1a
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/004.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test nullsafe property assignment
+--FILE--
+<?php
+
+$foo = null;
+var_dump($foo?->bar = 'bar');
+
+?>
+--EXPECTF--
+Fatal error: Can't use nullsafe operator in write context in %s.php on line 4
diff --git a/Zend/tests/nullsafe_operator/005.phpt b/Zend/tests/nullsafe_operator/005.phpt
new file mode 100644
index 0000000000..e691401599
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/005.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test nullsafe property assignment op
+--FILE--
+<?php
+
+$foo = null;
+$foo?->bar += 1;
+
+?>
+--EXPECTF--
+Fatal error: Can't use nullsafe operator in write context in %s.php on line 4
diff --git a/Zend/tests/nullsafe_operator/006.phpt b/Zend/tests/nullsafe_operator/006.phpt
new file mode 100644
index 0000000000..2cbecd2dda
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/006.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test nullsafe property post increment
+--FILE--
+<?php
+
+$foo = null;
+++$foo?->bar;
+
+?>
+--EXPECTF--
+Fatal error: Can't use nullsafe operator in write context in %s.php on line 4
diff --git a/Zend/tests/nullsafe_operator/007.phpt b/Zend/tests/nullsafe_operator/007.phpt
new file mode 100644
index 0000000000..a04af8ea83
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/007.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test nullsafe property pre increment
+--FILE--
+<?php
+
+$foo = null;
+var_dump($foo?->bar++);
+
+?>
+--EXPECTF--
+Fatal error: Can't use nullsafe operator in write context in %s.php on line 4
diff --git a/Zend/tests/nullsafe_operator/008.phpt b/Zend/tests/nullsafe_operator/008.phpt
new file mode 100644
index 0000000000..360d137b86
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/008.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test nullsafe property coalesce assignment
+--FILE--
+<?php
+
+$foo = null;
+var_dump($foo?->bar ??= 'bar');
+
+?>
+--EXPECTF--
+Fatal error: Can't use nullsafe operator in write context in %s.php on line 4
diff --git a/Zend/tests/nullsafe_operator/009.phpt b/Zend/tests/nullsafe_operator/009.phpt
new file mode 100644
index 0000000000..95df9dacc8
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/009.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test fetch nullsafe property by ref
+--FILE--
+<?php
+
+$foo = null;
+$ref = &$foo?->bar
+
+?>
+--EXPECTF--
+Fatal error: Cannot take reference of a nullsafe chain in %s.php on line 4
diff --git a/Zend/tests/nullsafe_operator/010.phpt b/Zend/tests/nullsafe_operator/010.phpt
new file mode 100644
index 0000000000..9f423a7c1e
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/010.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test fetch nested nullsafe property by ref
+--FILE--
+<?php
+
+$foo = null;
+$ref = &$foo?->bar->baz;
+
+?>
+--EXPECTF--
+Fatal error: Cannot take reference of a nullsafe chain in %s.php on line 4
diff --git a/Zend/tests/nullsafe_operator/011.phpt b/Zend/tests/nullsafe_operator/011.phpt
new file mode 100644
index 0000000000..61d60011f7
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/011.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Test isset and empty on nullsafe property
+--FILE--
+<?php
+
+class Foo {
+ public $bar;
+}
+
+class Bar {
+ public $baz;
+}
+$bar = new Bar();
+$bar->baz = 'baz';
+
+var_dump(isset($foo?->bar));
+var_dump(empty($foo?->bar));
+
+var_dump(isset($foo?->bar->baz));
+var_dump(empty($foo?->bar->baz));
+echo "\n";
+
+$foo = null;
+var_dump(isset($foo?->bar));
+var_dump(empty($foo?->bar));
+
+var_dump(isset($foo?->bar->baz));
+var_dump(empty($foo?->bar->baz));
+echo "\n";
+
+$foo = new Foo();
+var_dump(isset($foo?->bar->baz));
+var_dump(empty($foo?->bar->baz));
+
+$foo->bar = $bar;
+var_dump(isset($foo?->bar->baz));
+var_dump(empty($foo?->bar->baz));
+
+?>
+--EXPECT--
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+
+bool(false)
+bool(true)
+bool(true)
+bool(false)
diff --git a/Zend/tests/nullsafe_operator/012.phpt b/Zend/tests/nullsafe_operator/012.phpt
new file mode 100644
index 0000000000..a91e7652ca
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/012.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test nullsafe property on reference
+--FILE--
+<?php
+
+class Foo {
+ public $bar;
+}
+
+$foo = new Foo();
+$foo->bar = 'bar';
+
+$fooRef = &$foo;
+var_dump($fooRef?->bar);
+
+?>
+--EXPECT--
+string(3) "bar"
diff --git a/Zend/tests/nullsafe_operator/013.phpt b/Zend/tests/nullsafe_operator/013.phpt
new file mode 100644
index 0000000000..fd1fbc9006
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/013.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test nullsafe property in special functions
+--FILE--
+<?php
+
+function dump_error(callable $callable) {
+ try {
+ var_dump($callable());
+ } catch (Throwable $e) {
+ var_dump($e->getMessage());
+ }
+}
+
+function foo() {}
+
+$foo = null;
+dump_error(fn() => strlen($foo?->foo()));
+dump_error(fn() => is_null($foo?->foo()));
+dump_error(fn() => is_bool($foo?->foo()));
+dump_error(fn() => is_int($foo?->foo()));
+dump_error(fn() => is_scalar($foo?->foo()));
+dump_error(fn() => boolval($foo?->foo()));
+dump_error(fn() => defined($foo?->foo()));
+dump_error(fn() => chr($foo?->foo()));
+dump_error(fn() => ord($foo?->foo()));
+dump_error(fn() => call_user_func_array($foo?->foo(), []));
+dump_error(fn() => call_user_func_array('foo', $foo?->foo()));
+dump_error(fn() => get_class($foo?->foo()));
+dump_error(fn() => get_called_class($foo?->foo()));
+dump_error(fn() => gettype($foo?->foo()));
+dump_error(fn() => func_num_args($foo?->foo()));
+dump_error(fn() => func_get_args($foo?->foo()));
+dump_error(fn() => array_slice($foo?->foo(), 0));
+dump_error(fn() => array_slice(['foo'], $foo?->foo()));
+dump_error(fn() => array_slice(['foo'], 0, $foo?->foo()));
+dump_error(fn() => array_key_exists($foo?->foo(), []));
+dump_error(fn() => array_key_exists('foo', $foo?->foo()));
+
+?>
+--EXPECTF--
+int(0)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+string(1) "%s"
+int(0)
+string(98) "call_user_func_array(): Argument #1 ($function) must be a valid callback, no array or string given"
+string(77) "call_user_func_array(): Argument #2 ($args) must be of type array, null given"
+string(69) "get_class(): Argument #1 ($object) must be of type object, null given"
+string(55) "get_called_class() expects exactly 0 arguments, 1 given"
+string(4) "NULL"
+string(52) "func_num_args() expects exactly 0 arguments, 1 given"
+string(52) "func_get_args() expects exactly 0 arguments, 1 given"
+string(69) "array_slice(): Argument #1 ($array) must be of type array, null given"
+array(1) {
+ [0]=>
+ string(3) "foo"
+}
+array(1) {
+ [0]=>
+ string(3) "foo"
+}
+bool(false)
+string(74) "array_key_exists(): Argument #2 ($array) must be of type array, null given"
diff --git a/Zend/tests/nullsafe_operator/014.phpt b/Zend/tests/nullsafe_operator/014.phpt
new file mode 100644
index 0000000000..896e831ec9
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/014.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test nullsafe in binary op
+--FILE--
+<?php
+
+function try_and_dump($fn) {
+ try {
+ var_dump($fn());
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+}
+
+class Foo {
+ public function bar() {
+ echo "bar\n";
+ }
+}
+
+$foo = new Foo();
+$null = null;
+
+try_and_dump(fn() => $null?->null() + $null?->null());
+try_and_dump(fn() => $foo?->bar() + $null?->null());
+try_and_dump(fn() => $null?->null() + $foo?->bar());
+try_and_dump(fn() => $foo->bar() + $null?->null());
+try_and_dump(fn() => $null?->null() + $foo->bar());
+try_and_dump(fn() => $null?->null() + $null->null());
+try_and_dump(fn() => $null->null() + $null?->null());
+try_and_dump(fn() => ($foo?->bar() + $foo?->bar())?->baz());
+
+?>
+--EXPECT--
+int(0)
+bar
+int(0)
+bar
+int(0)
+bar
+int(0)
+bar
+int(0)
+Call to a member function null() on null
+Call to a member function null() on null
+bar
+bar
+Call to a member function baz() on int
diff --git a/Zend/tests/nullsafe_operator/015.phpt b/Zend/tests/nullsafe_operator/015.phpt
new file mode 100644
index 0000000000..f63758e759
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/015.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test nullsafe in binary op
+--FILE--
+<?php
+
+(new stdClass)->{null?->x}->y;
+
+?>
+--EXPECTF--
+Warning: Undefined property: stdClass::$ in %s on line 3
+
+Warning: Attempt to read property "y" on null in %s on line 3
diff --git a/Zend/tests/nullsafe_operator/016.phpt b/Zend/tests/nullsafe_operator/016.phpt
new file mode 100644
index 0000000000..4568da19cd
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/016.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test nullsafe in function argument
+--FILE--
+<?php
+
+class Foo {
+ public $bar;
+}
+
+function set(&$ref, $value) {
+ $ref = $value;
+}
+
+function test($foo) {
+ try {
+ set($foo?->bar, 'bar');
+ } catch (Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ (strrev('tes'))($foo?->bar, 'bar2');
+ } catch (Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+}
+
+test(null);
+test(new Foo());
+
+?>
+--EXPECT--
+set(): Argument #1 ($ref) cannot be passed by reference
+set(): Argument #1 ($ref) cannot be passed by reference
+set(): Argument #1 ($ref) cannot be passed by reference
+set(): Argument #1 ($ref) cannot be passed by reference
diff --git a/Zend/tests/nullsafe_operator/017.phpt b/Zend/tests/nullsafe_operator/017.phpt
new file mode 100644
index 0000000000..b38a371bf0
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/017.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test return nullsafe as ref
+--FILE--
+<?php
+
+function &get_bar_ref($foo) {
+ return $foo?->bar;
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot take reference of a nullsafe chain in %s.php on line 4
diff --git a/Zend/tests/nullsafe_operator/018.phpt b/Zend/tests/nullsafe_operator/018.phpt
new file mode 100644
index 0000000000..8d018f53bf
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/018.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test nullsafe on undefined variable
+--FILE--
+<?php
+
+var_dump($foo?->bar);
+var_dump($foo?->bar());
+var_dump($foo);
+
+?>
+--EXPECTF--
+Warning: Undefined variable $foo in %s.php on line 3
+NULL
+
+Warning: Undefined variable $foo in %s.php on line 4
+NULL
+
+Warning: Undefined variable $foo in %s.php on line 5
+NULL
diff --git a/Zend/tests/nullsafe_operator/019.phpt b/Zend/tests/nullsafe_operator/019.phpt
new file mode 100644
index 0000000000..3b1982afa3
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/019.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test nullsafe in new
+--FILE--
+<?php
+
+class Bar {}
+
+class Foo {
+ public $bar;
+}
+
+$foo = new Foo();
+$foo->bar = 'bar';
+var_dump(new $foo?->bar);
+
+$foo = null;
+var_dump(new $foo?->bar);
+
+?>
+--EXPECTF--
+object(Bar)#2 (0) {
+}
+
+Fatal error: Uncaught Error: Class name must be a valid object or a string in %s.php:14
+Stack trace:
+#0 {main}
+ thrown in %s.php on line 14
diff --git a/Zend/tests/nullsafe_operator/020.phpt b/Zend/tests/nullsafe_operator/020.phpt
new file mode 100644
index 0000000000..4d06ce616c
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/020.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test nullsafe lhs of assignment to nested property chain
+--FILE--
+<?php
+
+class Foo {
+ public $bar;
+}
+
+function bar() {
+ var_dump('called');
+}
+
+$foo = null;
+$foo?->bar->baz = bar();
+
+?>
+--EXPECTF--
+Fatal error: Can't use nullsafe operator in write context in %s.php on line 12
diff --git a/Zend/tests/nullsafe_operator/021.phpt b/Zend/tests/nullsafe_operator/021.phpt
new file mode 100644
index 0000000000..07116c90ab
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/021.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test nullsafe in list assign
+--FILE--
+<?php
+
+class Foo {
+ public $bar;
+}
+
+class Bar {
+ public $baz;
+}
+
+$foo = new Foo();
+$foo->bar = new Bar();
+
+[$foo?->bar->baz] = ['bar'];
+var_dump($foo);
+
+?>
+--EXPECTF--
+Fatal error: Assignments can only happen to writable values in %s on line %d
diff --git a/Zend/tests/nullsafe_operator/022.phpt b/Zend/tests/nullsafe_operator/022.phpt
new file mode 100644
index 0000000000..6dbb72d9b5
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/022.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test nullsafe in unset
+--FILE--
+<?php
+
+$foo = null;
+unset($foo?->bar->baz);
+
+?>
+--EXPECTF--
+Fatal error: Can't use nullsafe operator in write context in %s.php on line 4
diff --git a/Zend/tests/nullsafe_operator/023.phpt b/Zend/tests/nullsafe_operator/023.phpt
new file mode 100644
index 0000000000..15007c8de9
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/023.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Foreach by reference on nullsafe
+--FILE--
+<?php
+
+class Foo {
+ public $bar;
+}
+
+$foo = new Foo();
+
+foreach ($foo?->bar as &$value) {
+ var_dump($value);
+}
+
+// Don't convert $foo->bar into a reference.
+$foo->bar = [42];
+foreach ($foo?->bar as &$value) {
+ var_dump($value);
+ $value++;
+}
+var_dump($foo->bar);
+
+// But respect interior references.
+$ref =& $foo->bar[0];
+foreach ($foo?->bar as &$value) {
+ var_dump($value);
+ $value++;
+}
+var_dump($foo->bar);
+
+?>
+--EXPECTF--
+Warning: foreach() argument must be of type array|object, null given in %s on line %d
+int(42)
+array(1) {
+ [0]=>
+ int(42)
+}
+int(42)
+array(1) {
+ [0]=>
+ &int(43)
+}
diff --git a/Zend/tests/nullsafe_operator/024.phpt b/Zend/tests/nullsafe_operator/024.phpt
new file mode 100644
index 0000000000..220e9ea506
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/024.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test nullsafe as foreach target
+--FILE--
+<?php
+
+$foo = null;
+foreach ([1, 2, 3] as $foo?->bar) {}
+
+?>
+--EXPECTF--
+Fatal error: Can't use nullsafe operator in write context in %s.php on line 4
diff --git a/Zend/tests/nullsafe_operator/025.phpt b/Zend/tests/nullsafe_operator/025.phpt
new file mode 100644
index 0000000000..eadb906866
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/025.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Nullsafe chains in variable variables
+--FILE--
+<?php
+
+$a = null;
+var_dump(${$a?->b}->c);
+
+?>
+--EXPECTF--
+Warning: Undefined variable $ in %s on line %d
+
+Warning: Attempt to read property "c" on null in %s on line %d
+NULL
diff --git a/Zend/tests/nullsafe_operator/026.phpt b/Zend/tests/nullsafe_operator/026.phpt
new file mode 100644
index 0000000000..c4e825febb
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/026.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Nullsafe chain in static property / method name
+--FILE--
+<?php
+
+class Test {
+}
+
+$null = null;
+
+try {
+ Test::${$null?->foo}->bar;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ Test::{$null?->foo}()->bar;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Access to undeclared static property Test::$
+Method name must be a string
diff --git a/Zend/tests/nullsafe_operator/027.phpt b/Zend/tests/nullsafe_operator/027.phpt
new file mode 100644
index 0000000000..9e08a562c2
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/027.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test nullsafe in sub-chain of function argument
+--FILE--
+<?php
+
+function takes_ref(&$foo) {
+ $foo = 'foo';
+}
+
+function &returns_ref($ref) {
+ global $foo;
+ return $foo;
+}
+
+global $foo;
+
+$null = null;
+takes_ref(returns_ref($null?->null()));
+var_dump($foo);
+
+?>
+--EXPECT--
+string(3) "foo"
diff --git a/Zend/tests/nullsafe_operator/028.phpt b/Zend/tests/nullsafe_operator/028.phpt
new file mode 100644
index 0000000000..e85c014b65
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/028.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test nullsafe in sub-chain of return as ref
+--FILE--
+<?php
+
+function &returns_ref($unused) {
+ global $foo;
+ return $foo;
+}
+
+function &returns_ref2() {
+ $null = null;
+ return returns_ref($null?->null);
+}
+
+global $foo;
+
+$foo2 = &returns_ref2();
+$foo2 = 'foo';
+var_dump($foo);
+
+?>
+--EXPECT--
+string(3) "foo"
diff --git a/Zend/tests/nullsafe_operator/029.phpt b/Zend/tests/nullsafe_operator/029.phpt
new file mode 100644
index 0000000000..92a17ef7c0
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/029.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Refcount of constant LHS with nullsafe operator
+--FILE--
+<?php
+['']?->a;
+__DIR__?->a;
+?>
+--EXPECTF--
+Warning: Attempt to read property "a" on array in %s on line %d
+
+Warning: Attempt to read property "a" on string in %s on line %d
diff --git a/Zend/tests/nullsafe_operator/030.phpt b/Zend/tests/nullsafe_operator/030.phpt
new file mode 100644
index 0000000000..7bff0b2524
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/030.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Empty on nullsafe method
+--FILE--
+<?php
+
+class Test {
+ public function method($value) {
+ return $value;
+ }
+}
+
+$null = null;
+var_dump(empty($null?->method()));
+$test = new Test;
+var_dump(empty($test?->method(false)));
+var_dump(empty($test?->method(42)));
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(false)
diff --git a/Zend/tests/nullsafe_operator/031.phpt b/Zend/tests/nullsafe_operator/031.phpt
new file mode 100644
index 0000000000..5d287ce05d
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/031.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Nullsafe operator on referenced value
+--FILE--
+<?php
+
+$val = null;
+$ref =& $val;
+var_dump($ref?->foo);
+
+$val = new stdClass;
+var_dump($ref?->foo);
+
+?>
+--EXPECTF--
+NULL
+
+Warning: Undefined property: stdClass::$foo in %s on line %d
+NULL
diff --git a/Zend/tests/nullsafe_operator/032.phpt b/Zend/tests/nullsafe_operator/032.phpt
new file mode 100644
index 0000000000..4718e66f15
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/032.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Nullsafe operator on $this
+--FILE--
+<?php
+
+class Test {
+ public $foo = 42;
+
+ public function method() {
+ var_dump($this?->foo);
+ var_dump($this?->bar());
+ }
+
+ public function bar() {
+ return 24;
+ }
+}
+
+$test = new Test;
+$test->method();
+
+?>
+--EXPECT--
+int(42)
+int(24)
diff --git a/Zend/tests/nullsafe_operator/033.phpt b/Zend/tests/nullsafe_operator/033.phpt
new file mode 100644
index 0000000000..63ee2f850a
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/033.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test nullsafe operator in encaps vars
+--FILE--
+<?php
+
+class Foo {
+ public $bar = 'bar';
+
+ function qux() {
+ return 'qux';
+ }
+}
+
+$null = null;
+$foo = new Foo();
+
+var_dump("{$null?->foo}");
+var_dump("{$null?->bar()}");
+var_dump("$null?->foo");
+var_dump("$null?->bar()");
+
+var_dump("{$foo?->bar}");
+var_dump("{$foo?->baz}");
+var_dump("{$foo?->qux()}");
+try {
+ var_dump("{$foo?->quux()}");
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+var_dump("$foo?->bar");
+var_dump("$foo?->baz");
+var_dump("$foo?->qux()");
+try {
+ var_dump("$foo?->quux()");
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+string(0) ""
+string(0) ""
+string(0) ""
+string(2) "()"
+string(3) "bar"
+
+Warning: Undefined property: Foo::$baz in %s.php on line 20
+string(0) ""
+string(3) "qux"
+string(36) "Call to undefined method Foo::quux()"
+string(3) "bar"
+
+Warning: Undefined property: Foo::$baz in %s.php on line 29
+string(0) ""
+
+Warning: Undefined property: Foo::$qux in %s.php on line 30
+string(2) "()"
+
+Warning: Undefined property: Foo::$quux in %s.php on line 32
+string(2) "()"
diff --git a/Zend/tests/nullsafe_operator/034.phpt b/Zend/tests/nullsafe_operator/034.phpt
new file mode 100644
index 0000000000..a82cec6b22
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/034.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test nullsafe operator on delayed dim
+--FILE--
+<?php
+
+$arr = [
+ 'foo' => null,
+ 'bar' => [
+ 'baz' => null,
+ ],
+];
+
+var_dump($arr['foo']?->something);
+var_dump($arr['invalid']?->something);
+
+var_dump($arr['bar']['baz']?->something);
+var_dump($arr['bar']['invalid']?->something);
+
+?>
+--EXPECTF--
+NULL
+
+Warning: Undefined array key "invalid" in %s.php on line 11
+NULL
+NULL
+
+Warning: Undefined array key "invalid" in %s.php on line 14
+NULL
diff --git a/Zend/tests/nullsafe_operator/035.phpt b/Zend/tests/nullsafe_operator/035.phpt
new file mode 100644
index 0000000000..684c8c5d5f
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/035.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test nullsafe operator on delayed var
+--FILE--
+<?php
+
+class Foo {
+ public ?Bar $bar;
+}
+
+class Bar {
+ public string $baz;
+}
+
+$foo = new Foo();
+
+$foo->bar = null;
+var_dump($foo->bar?->baz);
+
+$bar = new Bar();
+$bar->baz = 'baz';
+$foo->bar = $bar;
+var_dump($foo->bar?->baz);
+
+?>
+--EXPECT--
+NULL
+string(3) "baz"
diff --git a/Zend/tests/nullsafe_operator/036.phpt b/Zend/tests/nullsafe_operator/036.phpt
new file mode 100644
index 0000000000..1874f733aa
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/036.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test nullsafe method call on delayed var
+--FILE--
+<?php
+
+class Foo {
+ public ?Bar $bar;
+}
+
+class Bar {
+ public function baz() {
+ return 'baz';
+ }
+}
+
+$foo = new Foo();
+
+$foo->bar = null;
+var_dump($foo->bar?->baz());
+
+$bar = new Bar();
+$foo->bar = $bar;
+var_dump($foo->bar?->baz());
+
+?>
+--EXPECT--
+NULL
+string(3) "baz"
diff --git a/Zend/tests/nullsafe_operator/037.phpt b/Zend/tests/nullsafe_operator/037.phpt
new file mode 100644
index 0000000000..5ce49ae029
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/037.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Test nullsafe operator in nested delayed dims
+--FILE--
+<?php
+
+$foo = new stdClass();
+$foo->bar = 'bar';
+
+$array = ['foo' => ['bar' => 'baz']];
+
+var_dump($array['foo'][$foo?->bar]);
+
+?>
+--EXPECT--
+string(3) "baz"
diff --git a/Zend/tests/nullsafe_operator/038.phpt b/Zend/tests/nullsafe_operator/038.phpt
new file mode 100644
index 0000000000..422de0b891
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/038.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test nullsafe operator in nested delayed dims 2
+--FILE--
+<?php
+
+$foo = (object) ['bar' => 0];
+$array = [[null]];
+var_dump($array[0][$foo->bar]?->baz);
+
+?>
+--EXPECT--
+NULL
diff --git a/Zend/tests/nullsafe_operator/039.phpt b/Zend/tests/nullsafe_operator/039.phpt
new file mode 100644
index 0000000000..92983c1592
--- /dev/null
+++ b/Zend/tests/nullsafe_operator/039.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Handling of undef variable exception in JMP_NULL
+--FILE--
+<?php
+
+set_error_handler(function($_, $m) {
+ throw new Exception($m);
+});
+
+try {
+ $foo?->foo;
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Undefined variable $foo
diff --git a/Zend/tests/numeric_literal_separator_001.phpt b/Zend/tests/numeric_literal_separator_001.phpt
index 866bd36fa9..f60c3f6138 100644
--- a/Zend/tests/numeric_literal_separator_001.phpt
+++ b/Zend/tests/numeric_literal_separator_001.phpt
@@ -13,6 +13,7 @@ var_dump(0b0101_1111 === 0b01011111);
var_dump(0b01_0000_10 === 0b01000010);
var_dump(0137_041 === 0137041);
var_dump(0_124 === 0124);
+?>
--EXPECT--
bool(true)
bool(true)
diff --git a/Zend/tests/numeric_literal_separator_002.phpt b/Zend/tests/numeric_literal_separator_002.phpt
index 984438fc07..5419d36851 100644
--- a/Zend/tests/numeric_literal_separator_002.phpt
+++ b/Zend/tests/numeric_literal_separator_002.phpt
@@ -3,5 +3,6 @@ Invalid use: trailing underscore
--FILE--
<?php
100_;
+?>
--EXPECTF--
-Parse error: syntax error, unexpected '_' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "_" in %s on line %d
diff --git a/Zend/tests/numeric_literal_separator_003.phpt b/Zend/tests/numeric_literal_separator_003.phpt
index e0cd716223..a01af7569a 100644
--- a/Zend/tests/numeric_literal_separator_003.phpt
+++ b/Zend/tests/numeric_literal_separator_003.phpt
@@ -3,5 +3,6 @@ Invalid use: adjacent underscores
--FILE--
<?php
10__0;
+?>
--EXPECTF--
-Parse error: syntax error, unexpected '__0' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "__0" in %s on line %d
diff --git a/Zend/tests/numeric_literal_separator_004.phpt b/Zend/tests/numeric_literal_separator_004.phpt
index 6db8f8eb86..f306eb952b 100644
--- a/Zend/tests/numeric_literal_separator_004.phpt
+++ b/Zend/tests/numeric_literal_separator_004.phpt
@@ -3,5 +3,6 @@ Invalid use: underscore left of period
--FILE--
<?php
100_.0;
+?>
--EXPECTF--
-Parse error: syntax error, unexpected '_' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "_" in %s on line %d
diff --git a/Zend/tests/numeric_literal_separator_005.phpt b/Zend/tests/numeric_literal_separator_005.phpt
index 4b454e2d17..85e2711c05 100644
--- a/Zend/tests/numeric_literal_separator_005.phpt
+++ b/Zend/tests/numeric_literal_separator_005.phpt
@@ -3,5 +3,6 @@ Invalid use: underscore right of period
--FILE--
<?php
100._0;
+?>
--EXPECTF--
-Parse error: syntax error, unexpected '_0' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "_0" in %s on line %d
diff --git a/Zend/tests/numeric_literal_separator_006.phpt b/Zend/tests/numeric_literal_separator_006.phpt
index 14bd290992..a6582d0c39 100644
--- a/Zend/tests/numeric_literal_separator_006.phpt
+++ b/Zend/tests/numeric_literal_separator_006.phpt
@@ -3,5 +3,6 @@ Invalid use: underscore next to 0x
--FILE--
<?php
0x_0123;
+?>
--EXPECTF--
-Parse error: syntax error, unexpected 'x_0123' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "x_0123" in %s on line %d
diff --git a/Zend/tests/numeric_literal_separator_007.phpt b/Zend/tests/numeric_literal_separator_007.phpt
index e74c7ed033..c660ee523e 100644
--- a/Zend/tests/numeric_literal_separator_007.phpt
+++ b/Zend/tests/numeric_literal_separator_007.phpt
@@ -3,5 +3,6 @@ Invalid use: underscore next to 0b
--FILE--
<?php
0b_0101;
+?>
--EXPECTF--
-Parse error: syntax error, unexpected 'b_0101' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "b_0101" in %s on line %d
diff --git a/Zend/tests/numeric_literal_separator_008.phpt b/Zend/tests/numeric_literal_separator_008.phpt
index 66f1d0ff6a..7927bbcf99 100644
--- a/Zend/tests/numeric_literal_separator_008.phpt
+++ b/Zend/tests/numeric_literal_separator_008.phpt
@@ -3,5 +3,6 @@ Invalid use: underscore left of e
--FILE--
<?php
1_e2;
+?>
--EXPECTF--
-Parse error: syntax error, unexpected '_e2' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "_e2" in %s on line %d
diff --git a/Zend/tests/numeric_literal_separator_009.phpt b/Zend/tests/numeric_literal_separator_009.phpt
index c690f66b10..d905ef2708 100644
--- a/Zend/tests/numeric_literal_separator_009.phpt
+++ b/Zend/tests/numeric_literal_separator_009.phpt
@@ -3,5 +3,6 @@ Invalid use: underscore right of e
--FILE--
<?php
1e_2;
+?>
--EXPECTF--
-Parse error: syntax error, unexpected 'e_2' (T_STRING) in %s on line %d
+Parse error: syntax error, unexpected identifier "e_2" in %s on line %d
diff --git a/Zend/tests/numeric_strings/array_offset.phpt b/Zend/tests/numeric_strings/array_offset.phpt
new file mode 100644
index 0000000000..4bca89f04a
--- /dev/null
+++ b/Zend/tests/numeric_strings/array_offset.phpt
@@ -0,0 +1,86 @@
+--TEST--
+Using different sorts of numerical strings as an array offset
+--FILE--
+<?php
+
+$arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
+
+var_dump($arr["7"]);
+var_dump($arr["7.5"]);
+var_dump($arr[" 7"]);
+var_dump($arr[" 7.5"]);
+var_dump($arr[" 7 "]);
+var_dump($arr[" 7.5 "]);
+var_dump($arr["7 "]);
+var_dump($arr["7.5 "]);
+var_dump($arr["7str"]);
+var_dump($arr["7.5str"]);
+var_dump($arr[" 7str"]);
+var_dump($arr[" 7.5str"]);
+var_dump($arr[" 7 str"]);
+var_dump($arr[" 7.5 str"]);
+var_dump($arr["7 str"]);
+var_dump($arr["7.5 str"]);
+var_dump($arr["0xA"]);
+var_dump($arr["0b10"]);
+var_dump($arr["07"]);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(7)
+
+Warning: Undefined array key "7.5" in %s on line %d
+NULL
+
+Warning: Undefined array key " 7" in %s on line %d
+NULL
+
+Warning: Undefined array key " 7.5" in %s on line %d
+NULL
+
+Warning: Undefined array key " 7 " in %s on line %d
+NULL
+
+Warning: Undefined array key " 7.5 " in %s on line %d
+NULL
+
+Warning: Undefined array key "7 " in %s on line %d
+NULL
+
+Warning: Undefined array key "7.5 " in %s on line %d
+NULL
+
+Warning: Undefined array key "7str" in %s on line %d
+NULL
+
+Warning: Undefined array key "7.5str" in %s on line %d
+NULL
+
+Warning: Undefined array key " 7str" in %s on line %d
+NULL
+
+Warning: Undefined array key " 7.5str" in %s on line %d
+NULL
+
+Warning: Undefined array key " 7 str" in %s on line %d
+NULL
+
+Warning: Undefined array key " 7.5 str" in %s on line %d
+NULL
+
+Warning: Undefined array key "7 str" in %s on line %d
+NULL
+
+Warning: Undefined array key "7.5 str" in %s on line %d
+NULL
+
+Warning: Undefined array key "0xA" in %s on line %d
+NULL
+
+Warning: Undefined array key "0b10" in %s on line %d
+NULL
+
+Warning: Undefined array key "07" in %s on line %d
+NULL
+Done
diff --git a/Zend/tests/numeric_strings/explicit_cast_leading_numeric_must_work.phpt b/Zend/tests/numeric_strings/explicit_cast_leading_numeric_must_work.phpt
new file mode 100644
index 0000000000..8c906e8f81
--- /dev/null
+++ b/Zend/tests/numeric_strings/explicit_cast_leading_numeric_must_work.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Explicit cast of leading numeric strings should still work without warning
+--FILE--
+<?php
+
+var_dump((int) "2px");
+var_dump((float) "2px");
+var_dump((int) "2.5px");
+var_dump((float) "2.5px");
+
+?>
+--EXPECT--
+int(2)
+float(2)
+int(2)
+float(2.5)
diff --git a/Zend/tests/numeric_string_errors_assign.phpt b/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt
index b13a7ec717..51df226348 100644
--- a/Zend/tests/numeric_string_errors_assign.phpt
+++ b/Zend/tests/numeric_strings/invalid_numeric_string_must_generate_warning_assign.phpt
@@ -1,5 +1,5 @@
--TEST--
-Invalid numeric string E_WARNINGs and E_NOTICEs, combined assignment operations
+Invalid numeric string TypeErrors and E_WARNINGs, combined assignment operations
--FILE--
<?php
@@ -11,37 +11,57 @@ function foxcache($val) {
$a = foxcache("2 Lorem");
$a += "3 ipsum";
var_dump($a);
-$a = foxcache("dolor");
-$a += "sit";
-var_dump($a);
+try {
+ $a = foxcache("dolor");
+ $a += "sit";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("5 amet,");
$a -= "7 consectetur";
var_dump($a);
-$a = foxcache("adipiscing");
-$a -= "elit,";
-var_dump($a);
+try {
+ $a = foxcache("adipiscing");
+ $a -= "elit,";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("11 sed");
$a *= "13 do";
var_dump($a);
-$a = foxcache("eiusmod");
-$a *= "tempor";
-var_dump($a);
+try {
+ $a = foxcache("eiusmod");
+ $a *= "tempor";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("17 incididunt");
$a /= "19 ut";
var_dump($a);
-$a = foxcache("labore");
-$a /= "et";
-var_dump($a);
+try {
+ $a = foxcache("labore");
+ $a /= "et";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("23 dolore");
$a **= "29 magna";
var_dump($a);
-$a = foxcache("aliqua.");
-$a **= "Ut";
-var_dump($a);
+try {
+ $a = foxcache("aliqua.");
+ $a **= "Ut";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("31 enim");
$a %= "37 ad";
@@ -50,22 +70,31 @@ try {
$a = foxcache("minim");
$a %= "veniam,";
var_dump($a);
-} catch (DivisionByZeroError $e) {
+} catch (\TypeError $e) {
+ echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL;
}
echo "---", PHP_EOL;
$a = foxcache("41 minim");
$a <<= "43 veniam,";
-var_dump($a);
-$a = foxcache("quis");
-$a <<= "nostrud";
+try {
+ var_dump($a);
+ $a = foxcache("quis");
+ $a <<= "nostrud";
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump($a);
echo "---", PHP_EOL;
$a = foxcache("47 exercitation");
$a >>= "53 ullamco";
var_dump($a);
-$a = foxcache("laboris");
-$a >>= "nisi";
-var_dump($a);
+try {
+ $a = foxcache("laboris");
+ $a >>= "nisi";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("59 ut");
$a |= 61;
@@ -73,12 +102,20 @@ var_dump($a);
$a = foxcache(67);
$a |= "71 aliquip";
var_dump($a);
-$a = foxcache("ex");
-$a |= 73;
-var_dump($a);
-$a = foxcache(79);
-$a |= "ea";
-var_dump($a);
+try {
+ $a = foxcache("ex");
+ $a |= 73;
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ $a = foxcache(79);
+ $a |= "ea";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("83 commodo");
$a &= 89;
@@ -86,12 +123,20 @@ var_dump($a);
$a = foxcache(97);
$a &= "101 consequat.";
var_dump($a);
-$a = foxcache("Duis");
-$a &= 103;
-var_dump($a);
-$a = foxcache(107);
-$a &= "aute";
-var_dump($a);
+try {
+ $a = foxcache("Duis");
+ $a &= 103;
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ $a = foxcache(107);
+ $a &= "aute";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
$a = foxcache("109 irure");
$a ^= 113;
@@ -99,137 +144,101 @@ var_dump($a);
$a = foxcache(127);
$a ^= "131 dolor";
var_dump($a);
-$a = foxcache("in");
-$a ^= 137;
-var_dump($a);
-$a = foxcache(139);
-$a ^= "reprehenderit";
-var_dump($a);
+try {
+ $a = foxcache("in");
+ $a ^= 137;
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ $a = foxcache(139);
+ $a ^= "reprehenderit";
+ var_dump($a);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
--EXPECTF--
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(5)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(5)
+Unsupported operand types: string + string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(-2)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(-2)
+Unsupported operand types: string - string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(143)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(143)
+Unsupported operand types: string * string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-float(0.89473684210526)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-
-Warning: Division by zero in %s on line %d
-float(NAN)
+float(0.8947368421052632)
+Unsupported operand types: string / string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-float(3.0910586430935E+39)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(1)
+float(3.0910586430935376E+39)
+Unsupported operand types: string ** string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(31)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
+int(31)
+TypeError: Unsupported operand types: string % string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(%d)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(%d)
+Unsupported operand types: string << string
+string(4) "quis"
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(0)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(0)
+Unsupported operand types: string >> string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(63)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(71)
-
Warning: A non-numeric value encountered in %s on line %d
-int(73)
+int(63)
Warning: A non-numeric value encountered in %s on line %d
-int(79)
+int(71)
+Unsupported operand types: string | int
+Unsupported operand types: int | string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(81)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(97)
-
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(81)
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(97)
+Unsupported operand types: string & int
+Unsupported operand types: int & string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(28)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(252)
-
Warning: A non-numeric value encountered in %s on line %d
-int(137)
+int(28)
Warning: A non-numeric value encountered in %s on line %d
-int(139)
+int(252)
+Unsupported operand types: string ^ int
+Unsupported operand types: int ^ string
diff --git a/Zend/tests/numeric_string_errors.phpt b/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt
index 15dcd04461..2b76f538f4 100644
--- a/Zend/tests/numeric_string_errors.phpt
+++ b/Zend/tests/numeric_strings/invalid_numeric_strings_must_generate_warning.phpt
@@ -1,194 +1,206 @@
--TEST--
-Invalid numeric string E_WARNINGs and E_NOTICEs
+Invalid numeric string TypeErrors and E_WARNINGs
--FILE--
<?php
var_dump("2 Lorem" + "3 ipsum");
-var_dump("dolor" + "sit");
+try {
+ var_dump("dolor" + "sit");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("5 amet," - "7 consectetur");
-var_dump("adipiscing" - "elit,");
+try {
+ var_dump("adipiscing" - "elit,");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("11 sed" * "13 do");
-var_dump("eiusmod" * "tempor");
+try {
+ var_dump("eiusmod" * "tempor");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("17 incididunt" / "19 ut");
-var_dump("labore" / "et");
+try {
+ var_dump("labore" / "et");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("23 dolore" ** "29 magna");
-var_dump("aliqua." ** "Ut");
+try {
+ var_dump("aliqua." ** "Ut");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("31 enim" % "37 ad");
try {
var_dump("minim" % "veniam,");
-} catch (DivisionByZeroError $e) {
+} catch (\TypeError $e) {
+ echo get_class($e) . ': ' . $e->getMessage() . \PHP_EOL;
}
echo "---", PHP_EOL;
var_dump("41 minim" << "43 veniam,");
-var_dump("quis" << "nostrud");
+try {
+ var_dump("quis" << "nostrud");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("47 exercitation" >> "53 ullamco");
-var_dump("laboris" >> "nisi");
+try {
+ var_dump("laboris" >> "nisi");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("59 ut" | 61);
var_dump(67 | "71 aliquip");
-var_dump("ex" | 73);
-var_dump(79 | "ea");
+try {
+ var_dump("ex" | 73);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(79 | "ea");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("83 commodo" & 89);
var_dump(97 & "101 consequat.");
-var_dump("Duis" & 103);
-var_dump(107 & "aute");
+try {
+ var_dump("Duis" & 103);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(107 & "aute");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump("109 irure" ^ 113);
var_dump(127 ^ "131 dolor");
-var_dump("in" ^ 137);
-var_dump(139 ^ "reprehenderit");
+try {
+ var_dump("in" ^ 137);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(139 ^ "reprehenderit");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump(+"149 in");
-var_dump(+"voluptate");
+try {
+ var_dump(+"voluptate");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "---", PHP_EOL;
var_dump(-"151 velit");
-var_dump(-"esse");
+try {
+ var_dump(-"esse");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
--EXPECTF--
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(5)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(5)
+Unsupported operand types: string + string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(-2)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(-2)
+Unsupported operand types: string - string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(143)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(143)
+Unsupported operand types: string * string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-float(0.89473684210526)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-
-Warning: Division by zero in %s on line %d
-float(NAN)
+float(0.8947368421052632)
+Unsupported operand types: string / string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-float(3.0910586430935E+39)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(1)
+float(3.0910586430935376E+39)
+Unsupported operand types: string ** string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(31)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
+int(31)
+TypeError: Unsupported operand types: string % string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(%d)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(%d)
+Unsupported operand types: string << string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(0)
-
Warning: A non-numeric value encountered in %s on line %d
Warning: A non-numeric value encountered in %s on line %d
int(0)
+Unsupported operand types: string >> string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(63)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(71)
-
Warning: A non-numeric value encountered in %s on line %d
-int(73)
+int(63)
Warning: A non-numeric value encountered in %s on line %d
-int(79)
+int(71)
+Unsupported operand types: string | int
+Unsupported operand types: int | string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(81)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(97)
-
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(81)
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(97)
+Unsupported operand types: string & int
+Unsupported operand types: int & string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(28)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(252)
-
Warning: A non-numeric value encountered in %s on line %d
-int(137)
+int(28)
Warning: A non-numeric value encountered in %s on line %d
-int(139)
+int(252)
+Unsupported operand types: string ^ int
+Unsupported operand types: int ^ string
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(149)
-
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(149)
+Unsupported operand types: string * int
---
-Notice: A non well formed numeric value encountered in %s on line %d
-int(-151)
-
Warning: A non-numeric value encountered in %s on line %d
-int(0)
+int(-151)
+Unsupported operand types: string * int
diff --git a/Zend/tests/neg_num_string.phpt b/Zend/tests/numeric_strings/neg_num_string.phpt
index 018568adea..018568adea 100644
--- a/Zend/tests/neg_num_string.phpt
+++ b/Zend/tests/numeric_strings/neg_num_string.phpt
diff --git a/Zend/tests/numeric_strings/string_offset.phpt b/Zend/tests/numeric_strings/string_offset.phpt
new file mode 100644
index 0000000000..0c43bc1512
--- /dev/null
+++ b/Zend/tests/numeric_strings/string_offset.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Using different sorts of numerical strings as a string offset
+--FILE--
+<?php
+
+$str = "The world is fun";
+
+$keys = [
+ "7",
+ "7.5",
+ " 7",
+ " 7.5",
+ " 7 ",
+ " 7.5 ",
+ "7 ",
+ "7.5 ",
+ "7str",
+ "7.5str",
+ " 7str",
+ " 7.5str",
+ " 7 str",
+ " 7.5 str",
+ "7 str",
+ "7.5 str",
+ "0xC",
+ "0b10",
+ "07",
+];
+
+foreach ($keys as $key) {
+ try {
+ var_dump($str[$key]);
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "l"
+Cannot access offset of type string on string
+string(1) "l"
+Cannot access offset of type string on string
+string(1) "l"
+Cannot access offset of type string on string
+string(1) "l"
+Cannot access offset of type string on string
+
+Warning: Illegal string offset "7str" in %s on line %d
+string(1) "l"
+Cannot access offset of type string on string
+
+Warning: Illegal string offset " 7str" in %s on line %d
+string(1) "l"
+Cannot access offset of type string on string
+
+Warning: Illegal string offset " 7 str" in %s on line %d
+string(1) "l"
+Cannot access offset of type string on string
+
+Warning: Illegal string offset "7 str" in %s on line %d
+string(1) "l"
+Cannot access offset of type string on string
+
+Warning: Illegal string offset "0xC" in %s on line %d
+string(1) "T"
+
+Warning: Illegal string offset "0b10" in %s on line %d
+string(1) "T"
+string(1) "l"
+Done
diff --git a/Zend/tests/numeric_strings/trailling_whitespaces.phpt b/Zend/tests/numeric_strings/trailling_whitespaces.phpt
new file mode 100644
index 0000000000..431a3f6691
--- /dev/null
+++ b/Zend/tests/numeric_strings/trailling_whitespaces.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Acceptance of whitespace in numeric strings
+--FILE--
+<?php
+
+$strings = [
+ "123",
+ "123 ",
+ "123 \t\n\r\v\f",
+ " 123",
+ " \t\n\r\v\f123",
+ " 123 ",
+ " \t\n\r\v\f123 \t\n\r\v\f",
+ "123.0",
+ "123.0 ",
+ "123.0 \t\n\r\v\f",
+ " 123.0",
+ " \t\n\r\v\f123.0",
+ " 123.0 ",
+ " \t\n\r\v\f123 \t\n\r\v\f",
+ "123e0",
+ "123e0 ",
+ "123e0 \t\n\r\v\f",
+ " 123e0",
+ " \t\n\r\v\f123e0",
+ " 123e0 ",
+ " \t\n\r\v\f123e0 \t\n\r\v\f"
+];
+
+function takes_integer(int $i) {
+ \assert($i === 123);
+}
+function takes_float(float $f) {
+ \assert($f === 123.0);
+}
+
+foreach ($strings as $string) {
+ \assert($string == 123);
+ $num = +$string;
+ \assert($num == 123);
+ takes_integer($string);
+ takes_float($string);
+ \assert(\intdiv($string, 1) === 123);
+ \assert(\is_numeric($string));
+ $incremented = $string;
+ ++$incremented;
+ \assert(\is_int($incremented) || \is_float($incremented));
+ \assert($incremented == 124);
+ $decremented = $string;
+ --$decremented;
+ \assert(\is_int($decremented) || \is_float($decremented));
+ \assert($decremented == 122);
+}
+
+echo "OK!", PHP_EOL;
+
+?>
+--EXPECT--
+OK!
diff --git a/Zend/tests/object_handlers.phpt b/Zend/tests/object_handlers.phpt
index 3e8dfcc537..5b45ac6956 100644
--- a/Zend/tests/object_handlers.phpt
+++ b/Zend/tests/object_handlers.phpt
@@ -3,34 +3,34 @@ Magic object handlers segfaults and memory errors
--FILE--
<?php
function f($x) {
- return $x;
+ return $x;
}
class foo implements ArrayAccess {
- function __get($property) {
- $GLOBALS["y"] = $property;
- }
- function __set($property, $value) {
- $GLOBALS["y"] = $property;
- }
- function __call($func, $args) {
- $GLOBALS["y"] = $func;
- }
- static function __callStatic($func, $args) {
- $GLOBALS["y"] = $func;
- }
- function offsetGet($index) {
- $GLOBALS["y"] = $index;
- }
- function offsetSet($index, $newval) {
- $GLOBALS["y"] = $index;
- }
- function offsetExists($index) {
- $GLOBALS["y"] = $index;
- }
- function offsetUnset($index) {
- $GLOBALS["y"] = $index;
- }
+ function __get($property) {
+ $GLOBALS["y"] = $property;
+ }
+ function __set($property, $value) {
+ $GLOBALS["y"] = $property;
+ }
+ function __call($func, $args) {
+ $GLOBALS["y"] = $func;
+ }
+ static function __callStatic($func, $args) {
+ $GLOBALS["y"] = $func;
+ }
+ function offsetGet($index) {
+ $GLOBALS["y"] = $index;
+ }
+ function offsetSet($index, $newval) {
+ $GLOBALS["y"] = $index;
+ }
+ function offsetExists($index) {
+ $GLOBALS["y"] = $index;
+ }
+ function offsetUnset($index) {
+ $GLOBALS["y"] = $index;
+ }
}
$x = new foo();
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/object_types/missing_return_type_inheritance_in_class.phpt b/Zend/tests/object_types/missing_return_type_inheritance_in_class.phpt
index 0938b24d0a..b401d2e311 100644
--- a/Zend/tests/object_types/missing_return_type_inheritance_in_class.phpt
+++ b/Zend/tests/object_types/missing_return_type_inheritance_in_class.phpt
@@ -10,5 +10,6 @@ class One {
class Two extends One {
public function a() {}
}
+?>
--EXPECTF--
Fatal error: Declaration of Two::a() must be compatible with One::a(): object in %s on line 8
diff --git a/Zend/tests/object_types/missing_return_type_inheritance_in_interface.phpt b/Zend/tests/object_types/missing_return_type_inheritance_in_interface.phpt
index eb0e98b635..e3652920c8 100644
--- a/Zend/tests/object_types/missing_return_type_inheritance_in_interface.phpt
+++ b/Zend/tests/object_types/missing_return_type_inheritance_in_interface.phpt
@@ -10,5 +10,6 @@ interface One {
interface Two extends One {
public function a();
}
+?>
--EXPECTF--
Fatal error: Declaration of Two::a() must be compatible with One::a(): object in %s on line %d
diff --git a/Zend/tests/object_types/return_type_in_class.phpt b/Zend/tests/object_types/return_type_in_class.phpt
index c4c1dc0516..3e44107373 100644
--- a/Zend/tests/object_types/return_type_in_class.phpt
+++ b/Zend/tests/object_types/return_type_in_class.phpt
@@ -17,9 +17,10 @@ $three = new class extends Two {
}
};
$three->a();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, int returned in %s:13
+Fatal error: Uncaught TypeError: Two@anonymous::a(): Return value must be of type object, int returned in %s:%d
Stack trace:
-#0 %s(16): class@anonymous->a()
+#0 %s(%d): Two@anonymous->a()
#1 {main}
thrown in %s on line 13
diff --git a/Zend/tests/object_types/return_type_in_function.phpt b/Zend/tests/object_types/return_type_in_function.phpt
index dc7e0463fd..5a6e1ba5c6 100644
--- a/Zend/tests/object_types/return_type_in_function.phpt
+++ b/Zend/tests/object_types/return_type_in_function.phpt
@@ -4,11 +4,12 @@ Adding a function object return type
<?php
function a() : object {
- return 12345;
+ return 12345;
}
a();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of a() must be an object, int returned in %s:4
+Fatal error: Uncaught TypeError: a(): Return value must be of type object, int returned in %s:%d
Stack trace:
#0 %s(6): a()
#1 {main}
diff --git a/Zend/tests/object_types/return_type_inheritance_in_class.phpt b/Zend/tests/object_types/return_type_inheritance_in_class.phpt
index a7316136fb..6e2dbac55c 100644
--- a/Zend/tests/object_types/return_type_inheritance_in_class.phpt
+++ b/Zend/tests/object_types/return_type_inheritance_in_class.phpt
@@ -17,9 +17,10 @@ $three = new class extends Two {
}
};
$three->a();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, int returned in %s:13
+Fatal error: Uncaught TypeError: Two@anonymous::a(): Return value must be of type object, int returned in %s:%d
Stack trace:
-#0 %s(16): class@anonymous->a()
+#0 %s(%d): Two@anonymous->a()
#1 {main}
thrown in %s on line 13
diff --git a/Zend/tests/object_types/return_type_inheritance_in_interface.phpt b/Zend/tests/object_types/return_type_inheritance_in_interface.phpt
index 4c8f6c08af..8bb5ad1616 100644
--- a/Zend/tests/object_types/return_type_inheritance_in_interface.phpt
+++ b/Zend/tests/object_types/return_type_inheritance_in_interface.phpt
@@ -17,9 +17,10 @@ $three = new class implements Two {
}
};
$three->a();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, int returned in %s:13
+Fatal error: Uncaught TypeError: Two@anonymous::a(): Return value must be of type object, int returned in %s:%d
Stack trace:
-#0 %s(16): class@anonymous->a()
+#0 %s(%d): Two@anonymous->a()
#1 {main}
thrown in %s on line 13
diff --git a/Zend/tests/object_types/return_type_reflection.phpt b/Zend/tests/object_types/return_type_reflection.phpt
index ac01d90894..0791be9f9f 100644
--- a/Zend/tests/object_types/return_type_reflection.phpt
+++ b/Zend/tests/object_types/return_type_reflection.phpt
@@ -21,6 +21,7 @@ var_dump($returnTypeTwo->isBuiltin(), $returnTypeTwo->getName());
$returnTypea = (new ReflectionFunction('a'))->getReturnType();
var_dump($returnTypea->isBuiltin(), $returnTypea->getName());
+?>
--EXPECT--
bool(true)
string(6) "object"
diff --git a/Zend/tests/object_types/type_hint_in_class_method.phpt b/Zend/tests/object_types/type_hint_in_class_method.phpt
index f8814e4bbb..305f44719d 100644
--- a/Zend/tests/object_types/type_hint_in_class_method.phpt
+++ b/Zend/tests/object_types/type_hint_in_class_method.phpt
@@ -10,8 +10,9 @@ class One {
$one = new One();
$one->a(new One());
$one->a(123);
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to One::a() must be an object, int given, called in %s:4
+Fatal error: Uncaught TypeError: One::a(): Argument #1 ($obj) must be of type object, int given, called in %s:%d
Stack trace:
#0 %s(9): One->a(123)
#1 {main}
diff --git a/Zend/tests/object_types/type_hint_in_function.phpt b/Zend/tests/object_types/type_hint_in_function.phpt
index 39e075efdb..75cbd68f3b 100644
--- a/Zend/tests/object_types/type_hint_in_function.phpt
+++ b/Zend/tests/object_types/type_hint_in_function.phpt
@@ -8,8 +8,9 @@ function a(object $obj) {}
a(new A());
a(123);
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to a() must be an object, int given, called in %s.php on line 7 and defined in %s:4
+Fatal error: Uncaught TypeError: a(): Argument #1 ($obj) must be of type object, int given, called in %s:%d
Stack trace:
#0 %s(7): a(123)
#1 {main}
diff --git a/Zend/tests/object_types/type_hint_reflection.phpt b/Zend/tests/object_types/type_hint_reflection.phpt
index b530e6dc04..df046de097 100644
--- a/Zend/tests/object_types/type_hint_reflection.phpt
+++ b/Zend/tests/object_types/type_hint_reflection.phpt
@@ -21,6 +21,7 @@ var_dump($typeHintTwo->isBuiltin(), $typeHintTwo->getName());
$typeHinta = (new ReflectionFunction('a'))->getParameters()[0]->getType();
var_dump($typeHinta->isBuiltin(), $typeHinta->getName());
+?>
--EXPECT--
bool(true)
string(6) "object"
diff --git a/Zend/tests/objects_002.phpt b/Zend/tests/objects_002.phpt
index 1c45b2230c..ba94c50ac7 100644
--- a/Zend/tests/objects_002.phpt
+++ b/Zend/tests/objects_002.phpt
@@ -6,19 +6,17 @@ error_reporting=8191
<?php
class test {
- function foo() {}
+ function foo() {}
}
class test2 extends test {
- function foo() {}
+ function foo() {}
}
class test3 extends test {
- function foo($arg) {}
+ 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..d4fc2e58fc 100644
--- a/Zend/tests/objects_003.phpt
+++ b/Zend/tests/objects_003.phpt
@@ -6,19 +6,17 @@ error_reporting=8191
<?php
class test {
- function foo($arg) {}
+ function foo($arg) {}
}
class test2 extends test {
- function foo($arg) {}
+ function foo($arg) {}
}
class test3 extends test {
- function foo($arg, $arg2) {}
+ 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..6af4e813de 100644
--- a/Zend/tests/objects_004.phpt
+++ b/Zend/tests/objects_004.phpt
@@ -6,19 +6,17 @@ error_reporting=8191
<?php
class test {
- function foo($arg) {}
+ function foo($arg) {}
}
class test2 extends test {
- function foo($arg) {}
+ function foo($arg) {}
}
class test3 extends test {
- function foo(&$arg) {}
+ 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..9b9a41465f 100644
--- a/Zend/tests/objects_005.phpt
+++ b/Zend/tests/objects_005.phpt
@@ -6,19 +6,17 @@ error_reporting=8191
<?php
class test {
- function &foo() {}
+ function &foo() {}
}
class test2 extends test {
- function &foo() {}
+ function &foo() {}
}
class test3 extends test {
- function foo() {}
+ 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..75043082b0 100644
--- a/Zend/tests/objects_006.phpt
+++ b/Zend/tests/objects_006.phpt
@@ -6,19 +6,17 @@ error_reporting=8191
<?php
class test {
- function foo($arg, $arg2 = NULL) {}
+ function foo($arg, $arg2 = NULL) {}
}
class test2 extends test {
- function foo($arg, $arg2 = NULL) {}
+ function foo($arg, $arg2 = NULL) {}
}
class test3 extends test {
- function foo($arg, $arg2) {}
+ 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..6147b3071d 100644
--- a/Zend/tests/objects_007.phpt
+++ b/Zend/tests/objects_007.phpt
@@ -6,19 +6,17 @@ error_reporting=8191
<?php
class test {
- function foo($arg, &$arg2 = NULL) {}
+ function foo($arg, &$arg2 = NULL) {}
}
class test2 extends test {
- function foo($arg, &$arg2 = NULL) {}
+ function foo($arg, &$arg2 = NULL) {}
}
class test3 extends test {
- function foo($arg, &$arg2) {}
+ 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..fe5d2741e4 100644
--- a/Zend/tests/objects_008.phpt
+++ b/Zend/tests/objects_008.phpt
@@ -6,19 +6,17 @@ error_reporting=8191
<?php
class test {
- function foo(Test $arg) {}
+ function foo(Test $arg) {}
}
class test2 extends test {
- function foo(Test $arg) {}
+ function foo(Test $arg) {}
}
class test3 extends test {
- function foo(Test3 $arg) {}
+ 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_009.phpt b/Zend/tests/objects_009.phpt
index 3c91b22742..f0e9c15d45 100644
--- a/Zend/tests/objects_009.phpt
+++ b/Zend/tests/objects_009.phpt
@@ -6,15 +6,15 @@ error_reporting=8191
<?php
class test {
- function foo(Test $arg) {}
+ function foo(Test $arg) {}
}
class test2 extends test {
- function foo(Test $arg) {}
+ function foo(Test $arg) {}
}
class test3 extends test {
- function foo($arg) {}
+ function foo($arg) {}
}
echo "Done\n";
diff --git a/Zend/tests/objects_010.phpt b/Zend/tests/objects_010.phpt
index 19fbd1b0f0..b146d6a236 100644
--- a/Zend/tests/objects_010.phpt
+++ b/Zend/tests/objects_010.phpt
@@ -4,10 +4,10 @@ redefining constructor (__construct second)
<?php
class test {
- function test() {
- }
- function __construct() {
- }
+ function test() {
+ }
+ function __construct() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/objects_011.phpt b/Zend/tests/objects_011.phpt
index c7d1e876f5..cd33604f24 100644
--- a/Zend/tests/objects_011.phpt
+++ b/Zend/tests/objects_011.phpt
@@ -6,10 +6,10 @@ error_reporting=8191
<?php
class test {
- function __construct() {
- }
- function test() {
- }
+ function __construct() {
+ }
+ function test() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/objects_015.phpt b/Zend/tests/objects_015.phpt
index 714d27ad5b..e0f5e9a93d 100644
--- a/Zend/tests/objects_015.phpt
+++ b/Zend/tests/objects_015.phpt
@@ -14,7 +14,6 @@ var_dump($o != null);
var_dump(is_null($o));
?>
-===DONE===
--EXPECT--
bool(false)
bool(true)
@@ -23,4 +22,3 @@ bool(true)
bool(false)
bool(true)
bool(false)
-===DONE===
diff --git a/Zend/tests/objects_017.phpt b/Zend/tests/objects_017.phpt
index ab992b682e..389d195ed1 100644
--- a/Zend/tests/objects_017.phpt
+++ b/Zend/tests/objects_017.phpt
@@ -4,11 +4,11 @@ Testing visibility of object returned by function
<?php
class foo {
- private $test = 1;
+ private $test = 1;
}
function test() {
- return new foo;
+ return new foo;
}
test()->test = 2;
diff --git a/Zend/tests/objects_018.phpt b/Zend/tests/objects_018.phpt
index 98ea982940..35a6d9542c 100644
--- a/Zend/tests/objects_018.phpt
+++ b/Zend/tests/objects_018.phpt
@@ -4,11 +4,11 @@ Using the same function name on interface with inheritance
<?php
interface Itest {
- function a();
+ function a();
}
interface Itest2 {
- function a();
+ function a();
}
interface Itest3 extends Itest, Itest2 {
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_021.phpt b/Zend/tests/objects_021.phpt
index d1fc63a38b..a00ffaabe9 100644
--- a/Zend/tests/objects_021.phpt
+++ b/Zend/tests/objects_021.phpt
@@ -4,33 +4,33 @@ Testing magic methods __set, __get and __call in cascade
<?php
class test {
- static public $i = 0;
+ static public $i = 0;
- public function __construct() {
- self::$i++;
- }
+ public function __construct() {
+ self::$i++;
+ }
- public function __set($a, $b) {
- return x();
- }
+ public function __set($a, $b) {
+ return x();
+ }
- public function __get($a) {
- return x();
- }
+ public function __get($a) {
+ return x();
+ }
- public function __call($a, $b) {
- return x();
- }
+ public function __call($a, $b) {
+ return x();
+ }
}
function x() {
- return new test;
+ return new test;
}
x()
- ->a
- ->b()
- ->c = 1;
+ ->a
+ ->b()
+ ->c = 1;
var_dump(test::$i);
diff --git a/Zend/tests/objects_022.phpt b/Zend/tests/objects_022.phpt
index d5a695739f..5fa6f8e95d 100644
--- a/Zend/tests/objects_022.phpt
+++ b/Zend/tests/objects_022.phpt
@@ -36,7 +36,7 @@ object(bar)#%d (0) {
object(baz)#%d (0) {
}
-Fatal error: Uncaught TypeError: Argument 1 passed to foo::testFoo() must be an instance of foo, instance of stdClass given, called in %s on line %d and defined in %s:%d
+Fatal error: Uncaught TypeError: foo::testFoo(): Argument #1 ($obj) must be of type foo, stdClass given, called in %s:%d
Stack trace:
#0 %s(%d): foo->testFoo(Object(stdClass))
#1 {main}
diff --git a/Zend/tests/objects_024.phpt b/Zend/tests/objects_024.phpt
index 50659f1604..3cf565984a 100644
--- a/Zend/tests/objects_024.phpt
+++ b/Zend/tests/objects_024.phpt
@@ -4,20 +4,20 @@ Testing direct assigning for property of object returned by function
<?php
class foo {
- static $bar = array();
+ static $bar = array();
- public function __set($a, $b) {
- self::$bar[] = $b;
- }
+ public function __set($a, $b) {
+ self::$bar[] = $b;
+ }
- public function __get($a) {
- /* last */
- return self::$bar[count(self::$bar)-1];
- }
+ public function __get($a) {
+ /* last */
+ return self::$bar[count(self::$bar)-1];
+ }
}
function test() {
- return new foo;
+ return new foo;
}
$a = test()->bar = 1;
diff --git a/Zend/tests/objects_025.phpt b/Zend/tests/objects_025.phpt
index 53c1ae077a..4856e3bd3c 100644
--- a/Zend/tests/objects_025.phpt
+++ b/Zend/tests/objects_025.phpt
@@ -4,13 +4,13 @@ Testing invalid method names with __call and __callstatic
<?php
class foo {
- public function __call($a, $b) {
- print "non-static - ok\n";
- }
+ public function __call($a, $b) {
+ print "non-static - ok\n";
+ }
- public static function __callstatic($a, $b) {
- print "static - ok\n";
- }
+ public static function __callstatic($a, $b) {
+ print "static - ok\n";
+ }
}
$a = new foo;
diff --git a/Zend/tests/objects_026.phpt b/Zend/tests/objects_026.phpt
index b347cf721c..bd74119b59 100644
--- a/Zend/tests/objects_026.phpt
+++ b/Zend/tests/objects_026.phpt
@@ -4,7 +4,7 @@ Using $this when out of context
<?php
try {
- $this->a = 1;
+ $this->a = 1;
} catch (Exception $e) {
}
diff --git a/Zend/tests/objects_027.phpt b/Zend/tests/objects_027.phpt
index 6ee7d5a491..84dca0573a 100644
--- a/Zend/tests/objects_027.phpt
+++ b/Zend/tests/objects_027.phpt
@@ -4,39 +4,25 @@ Testing 'new static;' calling parent method
<?php
class bar {
- public function show() {
- var_dump(new static);
- }
+ public function show() {
+ var_dump(new static);
+ }
}
class foo extends bar {
- public function test() {
- parent::show();
- }
+ public function test() {
+ parent::show();
+ }
}
$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/objects_028.phpt b/Zend/tests/objects_028.phpt
index 5c76612938..88f21aa846 100644
--- a/Zend/tests/objects_028.phpt
+++ b/Zend/tests/objects_028.phpt
@@ -4,16 +4,16 @@ Testing 'static::' and 'parent::' in calls
<?php
class bar {
- public function __call($a, $b) {
- print "hello\n";
- }
+ public function __call($a, $b) {
+ print "hello\n";
+ }
}
class foo extends bar {
- public function __construct() {
- static::bar();
- parent::bar();
- }
+ public function __construct() {
+ static::bar();
+ parent::bar();
+ }
}
diff --git a/Zend/tests/objects_029.phpt b/Zend/tests/objects_029.phpt
index afccfa3d61..d18e4a8351 100644
--- a/Zend/tests/objects_029.phpt
+++ b/Zend/tests/objects_029.phpt
@@ -4,18 +4,18 @@ Trying to access undeclared static property
<?php
class bar {
- public function __set($a, $b) {
- print "hello\n";
- }
+ public function __set($a, $b) {
+ print "hello\n";
+ }
}
class foo extends bar {
- public function __construct() {
- static::$f = 1;
- }
- public function __set($a, $b) {
- print "foo\n";
- }
+ public function __construct() {
+ static::$f = 1;
+ }
+ public function __set($a, $b) {
+ print "foo\n";
+ }
}
@@ -23,7 +23,7 @@ new foo;
?>
--EXPECTF--
-Fatal error: Uncaught Error: Access to undeclared static property: foo::$f in %s:%d
+Fatal error: Uncaught Error: Access to undeclared static property foo::$f in %s:%d
Stack trace:
#0 %s(%d): foo->__construct()
#1 {main}
diff --git a/Zend/tests/objects_030.phpt b/Zend/tests/objects_030.phpt
index c42babc183..8f9c993da3 100644
--- a/Zend/tests/objects_030.phpt
+++ b/Zend/tests/objects_030.phpt
@@ -4,18 +4,18 @@ Trying to access undeclared parent property
<?php
class bar {
- public function __set($a, $b) {
- print "hello\n";
- }
+ public function __set($a, $b) {
+ print "hello\n";
+ }
}
class foo extends bar {
- public function __construct() {
- parent::$f = 1;
- }
- public function __set($a, $b) {
- print "foo\n";
- }
+ public function __construct() {
+ parent::$f = 1;
+ }
+ public function __set($a, $b) {
+ print "foo\n";
+ }
}
@@ -23,7 +23,7 @@ new foo;
?>
--EXPECTF--
-Fatal error: Uncaught Error: Access to undeclared static property: bar::$f in %s:%d
+Fatal error: Uncaught Error: Access to undeclared static property bar::$f in %s:%d
Stack trace:
#0 %s(%d): foo->__construct()
#1 {main}
diff --git a/Zend/tests/objects_032.phpt b/Zend/tests/objects_032.phpt
index 52a5e9fed9..b4312ac3f8 100644
--- a/Zend/tests/objects_032.phpt
+++ b/Zend/tests/objects_032.phpt
@@ -25,7 +25,6 @@ $a['foo']['bar'] = 2;
var_dump($a);
?>
-==DONE==
--EXPECT--
object(A)#1 (1) {
["foo"]=>
@@ -37,4 +36,3 @@ object(A)#1 (1) {
}
}
}
-==DONE==
diff --git a/Zend/tests/objects_033.phpt b/Zend/tests/objects_033.phpt
index 365edc3832..3c19864490 100644
--- a/Zend/tests/objects_033.phpt
+++ b/Zend/tests/objects_033.phpt
@@ -22,6 +22,7 @@ $b = new B(); $b->a = 1; $b->b = 0;
var_dump($a < $b);
print_r($a, true);
var_dump($a < $b);
+?>
--EXPECT--
bool(false)
bool(false)
diff --git a/Zend/tests/oct_overflow.phpt b/Zend/tests/oct_overflow.phpt
index 13ac419511..512a6abf66 100644
--- a/Zend/tests/oct_overflow.phpt
+++ b/Zend/tests/oct_overflow.phpt
@@ -6,16 +6,16 @@ precision=14
<?php
$doubles = array(
- 076545676543223,
- 032325463734,
- 0777777,
- 07777777777777,
- 033333333333333,
- );
+ 076545676543223,
+ 032325463734,
+ 0777777,
+ 07777777777777,
+ 033333333333333,
+ );
foreach ($doubles as $d) {
- $l = (double)$d;
- var_dump($l);
+ $l = (double)$d;
+ var_dump($l);
}
echo "Done\n";
diff --git a/Zend/tests/oct_overflow_char.phpt b/Zend/tests/oct_overflow_char.phpt
index 32060d8593..61de43d201 100644
--- a/Zend/tests/oct_overflow_char.phpt
+++ b/Zend/tests/oct_overflow_char.phpt
@@ -5,6 +5,7 @@ Octal overflow in string interpolation
// "abc", ordinarily 'b' would be \142, but we'll deliberately overflow the value by \400
echo "\141\542\143\n";
+?>
--EXPECTF--
Warning: Octal escape sequence overflow \542 is greater than \377 in %s%eoct_overflow_char.php on line 4
abc
diff --git a/Zend/tests/offset_array.phpt b/Zend/tests/offset_array.phpt
index a1d0a43c69..bd6baa1651 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";
?>
@@ -28,20 +36,16 @@ echo "Done\n";
int(2)
int(1)
-Notice: Undefined index: in %s on line %d
+Warning: Undefined array key "" in %s on line %d
NULL
-Notice: Undefined index: run away in %s on line %d
+Warning: Undefined array key "run away" in %s on line %d
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_assign.phpt b/Zend/tests/offset_assign.phpt
index 04a4f41e6c..d2e33cafbf 100644
--- a/Zend/tests/offset_assign.phpt
+++ b/Zend/tests/offset_assign.phpt
@@ -1,14 +1,14 @@
--TEST--
-Crash on $x['x']['y'] += 1 when $x is string
+Crash on $x['2x']['y'] += 1 when $x is string
--FILE--
<?php
$x = "a";
-$x['x']['y'] += 1;
+$x['2x']['y'] += 1;
echo "Done\n";
?>
--EXPECTF--
-Warning: Illegal string offset 'x' in %soffset_assign.php on line %d
+Warning: Illegal string offset "2x" in %s on line %d
Fatal error: Uncaught Error: Cannot use string offset as an array in %soffset_assign.php:%d
Stack trace:
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..f14c63af5d 100644
--- a/Zend/tests/offset_string.phpt
+++ b/Zend/tests/offset_string.phpt
@@ -8,58 +8,68 @@ $str = "Sitting on a corner all alone, staring from the bottom of his soul";
var_dump($str[1]);
var_dump($str[0.0836]);
var_dump($str[NULL]);
-var_dump($str["run away"]);
+try {
+ var_dump($str["run away"]);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump($str["13"]);
-var_dump($str["14.5"]);
+try {
+ var_dump($str["14.5"]);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump($str["15 and then some"]);
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
-string(1) "S"
-
-Warning: Illegal string offset 'run away' in %s on line %d
+Warning: String offset cast occurred in %s on line %d
string(1) "S"
+Cannot access offset of type string on string
string(1) "c"
+Cannot access offset of type string on string
-Warning: Illegal string offset '14.5' in %s on line %d
-string(1) "o"
-
-Notice: A non well formed numeric value encountered in %s on line %d
+Warning: Illegal string offset "15 and then some" 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"
+Cannot access offset of type resource on string
-Warning: Illegal offset type in %s on line %d
-string(1) "%s"
-
-Warning: Illegal offset type in %s on line %d
-
-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"
+Warning: Object of class stdClass could not be converted to int in %s on line %d
+Cannot access offset of type stdClass on string
+Cannot access offset of type array on string
Done
diff --git a/Zend/tests/operator_unsupported_types.phpt b/Zend/tests/operator_unsupported_types.phpt
new file mode 100644
index 0000000000..94e23ec603
--- /dev/null
+++ b/Zend/tests/operator_unsupported_types.phpt
@@ -0,0 +1,2066 @@
+--TEST--
+Using unsupported types with operators
+--FILE--
+<?php
+
+$binops = [
+ '+',
+ '-',
+ '*',
+ '/',
+ '%',
+ '**',
+ '<<',
+ '>>',
+ '&',
+ '|',
+ '^',
+ // Works on booleans, never errors.
+ 'xor',
+ // Only generates errors that string conversion emits.
+ '.',
+];
+$illegalValues = [
+ '[]',
+ 'new stdClass',
+ 'STDOUT',
+ '"foo"',
+];
+$legalValues = [
+ 'null',
+ 'true',
+ 'false',
+ '2',
+ '3.5',
+ '"123"',
+ '"123foo"', // Semi-legal
+];
+
+set_error_handler(function($errno, $errstr) {
+ assert($errno == E_WARNING);
+ echo "Warning: $errstr\n";
+});
+
+function evalBinOp(string $op, string $value1, string $value2) {
+ try {
+ eval("return $value1 $op $value2;");
+ echo "No error for $value1 $op $value2\n";
+ } catch (Throwable $e) {
+ echo $e->getMessage() . "\n";
+ }
+}
+
+function evalAssignOp(string $op, string $value1, string $value2) {
+ $x = $origX = eval("return $value1;");
+ try {
+ eval("\$x $op= $value2;");
+ echo "No error for $value1 $op= $value2\n";
+ } catch (Throwable $e) {
+ echo $e->getMessage() . "\n";
+ if ($x !== $origX) {
+ die("Value corrupted!");
+ }
+ }
+}
+
+echo "BINARY OP:\n";
+foreach ($binops as $op) {
+ foreach ($illegalValues as $illegalValue1) {
+ foreach ($illegalValues as $illegalValue2) {
+ evalBinOp($op, $illegalValue1, $illegalValue2);
+ }
+ }
+ foreach ($illegalValues as $illegalValue) {
+ foreach ($legalValues as $legalValue) {
+ evalBinOp($op, $illegalValue, $legalValue);
+ evalBinOp($op, $legalValue, $illegalValue);
+ }
+ }
+}
+
+echo "\n\nASSIGN OP:\n";
+foreach ($binops as $op) {
+ if ($op === 'xor') continue;
+
+ foreach ($illegalValues as $illegalValue1) {
+ foreach ($illegalValues as $illegalValue2) {
+ evalAssignOp($op, $illegalValue1, $illegalValue2);
+ }
+ }
+ foreach ($illegalValues as $illegalValue) {
+ foreach ($legalValues as $legalValue) {
+ evalAssignOp($op, $illegalValue, $legalValue);
+ evalAssignOp($op, $legalValue, $illegalValue);
+ }
+ }
+}
+
+echo "\n\nUNARY OP:\n";
+foreach ($illegalValues as $illegalValue) {
+ try {
+ eval("return ~$illegalValue;");
+ echo "No error for ~$illegalValue\n";
+ } catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
+ }
+}
+
+echo "\n\nINCDEC:\n";
+foreach ($illegalValues as $illegalValue) {
+ $copy = eval("return $illegalValue;");
+ try {
+ $copy++;
+ echo "No error for $copy++\n";
+ } catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
+ }
+ $copy = eval("return $illegalValue;");
+ try {
+ $copy--;
+ echo "No error for $copy--\n";
+ } catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
+ }
+}
+
+?>
+--EXPECT--
+BINARY OP:
+No error for [] + []
+Unsupported operand types: array + stdClass
+Unsupported operand types: array + resource
+Unsupported operand types: array + string
+Unsupported operand types: stdClass + array
+Unsupported operand types: stdClass + stdClass
+Unsupported operand types: stdClass + resource
+Unsupported operand types: stdClass + string
+Unsupported operand types: resource + array
+Unsupported operand types: resource + stdClass
+Unsupported operand types: resource + resource
+Unsupported operand types: resource + string
+Unsupported operand types: string + array
+Unsupported operand types: string + stdClass
+Unsupported operand types: string + resource
+Unsupported operand types: string + string
+Unsupported operand types: array + null
+Unsupported operand types: null + array
+Unsupported operand types: array + bool
+Unsupported operand types: bool + array
+Unsupported operand types: array + bool
+Unsupported operand types: bool + array
+Unsupported operand types: array + int
+Unsupported operand types: int + array
+Unsupported operand types: array + float
+Unsupported operand types: float + array
+Unsupported operand types: array + string
+Unsupported operand types: string + array
+Unsupported operand types: array + string
+Warning: A non-numeric value encountered
+Unsupported operand types: string + array
+Unsupported operand types: stdClass + null
+Unsupported operand types: null + stdClass
+Unsupported operand types: stdClass + bool
+Unsupported operand types: bool + stdClass
+Unsupported operand types: stdClass + bool
+Unsupported operand types: bool + stdClass
+Unsupported operand types: stdClass + int
+Unsupported operand types: int + stdClass
+Unsupported operand types: stdClass + float
+Unsupported operand types: float + stdClass
+Unsupported operand types: stdClass + string
+Unsupported operand types: string + stdClass
+Unsupported operand types: stdClass + string
+Warning: A non-numeric value encountered
+Unsupported operand types: string + stdClass
+Unsupported operand types: resource + null
+Unsupported operand types: null + resource
+Unsupported operand types: resource + bool
+Unsupported operand types: bool + resource
+Unsupported operand types: resource + bool
+Unsupported operand types: bool + resource
+Unsupported operand types: resource + int
+Unsupported operand types: int + resource
+Unsupported operand types: resource + float
+Unsupported operand types: float + resource
+Unsupported operand types: resource + string
+Unsupported operand types: string + resource
+Unsupported operand types: resource + string
+Warning: A non-numeric value encountered
+Unsupported operand types: string + resource
+Unsupported operand types: string + null
+Unsupported operand types: null + string
+Unsupported operand types: string + bool
+Unsupported operand types: bool + string
+Unsupported operand types: string + bool
+Unsupported operand types: bool + string
+Unsupported operand types: string + int
+Unsupported operand types: int + string
+Unsupported operand types: string + float
+Unsupported operand types: float + string
+Unsupported operand types: string + string
+Unsupported operand types: string + string
+Unsupported operand types: string + string
+Warning: A non-numeric value encountered
+Unsupported operand types: string + string
+Unsupported operand types: array - array
+Unsupported operand types: array - stdClass
+Unsupported operand types: array - resource
+Unsupported operand types: array - string
+Unsupported operand types: stdClass - array
+Unsupported operand types: stdClass - stdClass
+Unsupported operand types: stdClass - resource
+Unsupported operand types: stdClass - string
+Unsupported operand types: resource - array
+Unsupported operand types: resource - stdClass
+Unsupported operand types: resource - resource
+Unsupported operand types: resource - string
+Unsupported operand types: string - array
+Unsupported operand types: string - stdClass
+Unsupported operand types: string - resource
+Unsupported operand types: string - string
+Unsupported operand types: array - null
+Unsupported operand types: null - array
+Unsupported operand types: array - bool
+Unsupported operand types: bool - array
+Unsupported operand types: array - bool
+Unsupported operand types: bool - array
+Unsupported operand types: array - int
+Unsupported operand types: int - array
+Unsupported operand types: array - float
+Unsupported operand types: float - array
+Unsupported operand types: array - string
+Unsupported operand types: string - array
+Unsupported operand types: array - string
+Warning: A non-numeric value encountered
+Unsupported operand types: string - array
+Unsupported operand types: stdClass - null
+Unsupported operand types: null - stdClass
+Unsupported operand types: stdClass - bool
+Unsupported operand types: bool - stdClass
+Unsupported operand types: stdClass - bool
+Unsupported operand types: bool - stdClass
+Unsupported operand types: stdClass - int
+Unsupported operand types: int - stdClass
+Unsupported operand types: stdClass - float
+Unsupported operand types: float - stdClass
+Unsupported operand types: stdClass - string
+Unsupported operand types: string - stdClass
+Unsupported operand types: stdClass - string
+Warning: A non-numeric value encountered
+Unsupported operand types: string - stdClass
+Unsupported operand types: resource - null
+Unsupported operand types: null - resource
+Unsupported operand types: resource - bool
+Unsupported operand types: bool - resource
+Unsupported operand types: resource - bool
+Unsupported operand types: bool - resource
+Unsupported operand types: resource - int
+Unsupported operand types: int - resource
+Unsupported operand types: resource - float
+Unsupported operand types: float - resource
+Unsupported operand types: resource - string
+Unsupported operand types: string - resource
+Unsupported operand types: resource - string
+Warning: A non-numeric value encountered
+Unsupported operand types: string - resource
+Unsupported operand types: string - null
+Unsupported operand types: null - string
+Unsupported operand types: string - bool
+Unsupported operand types: bool - string
+Unsupported operand types: string - bool
+Unsupported operand types: bool - string
+Unsupported operand types: string - int
+Unsupported operand types: int - string
+Unsupported operand types: string - float
+Unsupported operand types: float - string
+Unsupported operand types: string - string
+Unsupported operand types: string - string
+Unsupported operand types: string - string
+Warning: A non-numeric value encountered
+Unsupported operand types: string - string
+Unsupported operand types: array * array
+Unsupported operand types: stdClass * array
+Unsupported operand types: resource * array
+Unsupported operand types: array * string
+Unsupported operand types: stdClass * array
+Unsupported operand types: stdClass * stdClass
+Unsupported operand types: stdClass * resource
+Unsupported operand types: stdClass * string
+Unsupported operand types: resource * array
+Unsupported operand types: stdClass * resource
+Unsupported operand types: resource * resource
+Unsupported operand types: resource * string
+Unsupported operand types: string * array
+Unsupported operand types: stdClass * string
+Unsupported operand types: resource * string
+Unsupported operand types: string * string
+Unsupported operand types: array * null
+Unsupported operand types: null * array
+Unsupported operand types: array * bool
+Unsupported operand types: bool * array
+Unsupported operand types: array * bool
+Unsupported operand types: bool * array
+Unsupported operand types: array * int
+Unsupported operand types: int * array
+Unsupported operand types: array * float
+Unsupported operand types: float * array
+Unsupported operand types: array * string
+Unsupported operand types: string * array
+Unsupported operand types: array * string
+Warning: A non-numeric value encountered
+Unsupported operand types: string * array
+Unsupported operand types: stdClass * null
+Unsupported operand types: stdClass * null
+Unsupported operand types: stdClass * bool
+Unsupported operand types: stdClass * bool
+Unsupported operand types: stdClass * bool
+Unsupported operand types: stdClass * bool
+Unsupported operand types: stdClass * int
+Unsupported operand types: stdClass * int
+Unsupported operand types: stdClass * float
+Unsupported operand types: stdClass * float
+Unsupported operand types: stdClass * string
+Unsupported operand types: stdClass * string
+Unsupported operand types: stdClass * string
+Unsupported operand types: stdClass * string
+Unsupported operand types: resource * null
+Unsupported operand types: resource * null
+Unsupported operand types: resource * bool
+Unsupported operand types: resource * bool
+Unsupported operand types: resource * bool
+Unsupported operand types: resource * bool
+Unsupported operand types: resource * int
+Unsupported operand types: resource * int
+Unsupported operand types: resource * float
+Unsupported operand types: resource * float
+Unsupported operand types: resource * string
+Unsupported operand types: resource * string
+Unsupported operand types: resource * string
+Unsupported operand types: resource * string
+Unsupported operand types: string * null
+Unsupported operand types: null * string
+Unsupported operand types: string * bool
+Unsupported operand types: bool * string
+Unsupported operand types: string * bool
+Unsupported operand types: bool * string
+Unsupported operand types: string * int
+Unsupported operand types: int * string
+Unsupported operand types: string * float
+Unsupported operand types: float * string
+Unsupported operand types: string * string
+Unsupported operand types: string * string
+Unsupported operand types: string * string
+Warning: A non-numeric value encountered
+Unsupported operand types: string * string
+Unsupported operand types: array / array
+Unsupported operand types: array / stdClass
+Unsupported operand types: array / resource
+Unsupported operand types: array / string
+Unsupported operand types: stdClass / array
+Unsupported operand types: stdClass / stdClass
+Unsupported operand types: stdClass / resource
+Unsupported operand types: stdClass / string
+Unsupported operand types: resource / array
+Unsupported operand types: resource / stdClass
+Unsupported operand types: resource / resource
+Unsupported operand types: resource / string
+Unsupported operand types: string / array
+Unsupported operand types: string / stdClass
+Unsupported operand types: string / resource
+Unsupported operand types: string / string
+Unsupported operand types: array / null
+Unsupported operand types: null / array
+Unsupported operand types: array / bool
+Unsupported operand types: bool / array
+Unsupported operand types: array / bool
+Unsupported operand types: bool / array
+Unsupported operand types: array / int
+Unsupported operand types: int / array
+Unsupported operand types: array / float
+Unsupported operand types: float / array
+Unsupported operand types: array / string
+Unsupported operand types: string / array
+Unsupported operand types: array / string
+Warning: A non-numeric value encountered
+Unsupported operand types: string / array
+Unsupported operand types: stdClass / null
+Unsupported operand types: null / stdClass
+Unsupported operand types: stdClass / bool
+Unsupported operand types: bool / stdClass
+Unsupported operand types: stdClass / bool
+Unsupported operand types: bool / stdClass
+Unsupported operand types: stdClass / int
+Unsupported operand types: int / stdClass
+Unsupported operand types: stdClass / float
+Unsupported operand types: float / stdClass
+Unsupported operand types: stdClass / string
+Unsupported operand types: string / stdClass
+Unsupported operand types: stdClass / string
+Warning: A non-numeric value encountered
+Unsupported operand types: string / stdClass
+Unsupported operand types: resource / null
+Unsupported operand types: null / resource
+Unsupported operand types: resource / bool
+Unsupported operand types: bool / resource
+Unsupported operand types: resource / bool
+Unsupported operand types: bool / resource
+Unsupported operand types: resource / int
+Unsupported operand types: int / resource
+Unsupported operand types: resource / float
+Unsupported operand types: float / resource
+Unsupported operand types: resource / string
+Unsupported operand types: string / resource
+Unsupported operand types: resource / string
+Warning: A non-numeric value encountered
+Unsupported operand types: string / resource
+Unsupported operand types: string / null
+Unsupported operand types: null / string
+Unsupported operand types: string / bool
+Unsupported operand types: bool / string
+Unsupported operand types: string / bool
+Unsupported operand types: bool / string
+Unsupported operand types: string / int
+Unsupported operand types: int / string
+Unsupported operand types: string / float
+Unsupported operand types: float / string
+Unsupported operand types: string / string
+Unsupported operand types: string / string
+Unsupported operand types: string / string
+Warning: A non-numeric value encountered
+Unsupported operand types: string / string
+Unsupported operand types: array % array
+Unsupported operand types: array % stdClass
+Unsupported operand types: array % resource
+Unsupported operand types: array % string
+Unsupported operand types: stdClass % array
+Unsupported operand types: stdClass % stdClass
+Unsupported operand types: stdClass % resource
+Unsupported operand types: stdClass % string
+Unsupported operand types: resource % array
+Unsupported operand types: resource % stdClass
+Unsupported operand types: resource % resource
+Unsupported operand types: resource % string
+Unsupported operand types: string % array
+Unsupported operand types: string % stdClass
+Unsupported operand types: string % resource
+Unsupported operand types: string % string
+Unsupported operand types: array % null
+Unsupported operand types: null % array
+Unsupported operand types: array % bool
+Unsupported operand types: bool % array
+Unsupported operand types: array % bool
+Unsupported operand types: bool % array
+Unsupported operand types: array % int
+Unsupported operand types: int % array
+Unsupported operand types: array % float
+Unsupported operand types: float % array
+Unsupported operand types: array % string
+Unsupported operand types: string % array
+Unsupported operand types: array % string
+Warning: A non-numeric value encountered
+Unsupported operand types: string % array
+Unsupported operand types: stdClass % null
+Unsupported operand types: null % stdClass
+Unsupported operand types: stdClass % bool
+Unsupported operand types: bool % stdClass
+Unsupported operand types: stdClass % bool
+Unsupported operand types: bool % stdClass
+Unsupported operand types: stdClass % int
+Unsupported operand types: int % stdClass
+Unsupported operand types: stdClass % float
+Unsupported operand types: float % stdClass
+Unsupported operand types: stdClass % string
+Unsupported operand types: string % stdClass
+Unsupported operand types: stdClass % string
+Warning: A non-numeric value encountered
+Unsupported operand types: string % stdClass
+Unsupported operand types: resource % null
+Unsupported operand types: null % resource
+Unsupported operand types: resource % bool
+Unsupported operand types: bool % resource
+Unsupported operand types: resource % bool
+Unsupported operand types: bool % resource
+Unsupported operand types: resource % int
+Unsupported operand types: int % resource
+Unsupported operand types: resource % float
+Unsupported operand types: float % resource
+Unsupported operand types: resource % string
+Unsupported operand types: string % resource
+Unsupported operand types: resource % string
+Warning: A non-numeric value encountered
+Unsupported operand types: string % resource
+Unsupported operand types: string % null
+Unsupported operand types: null % string
+Unsupported operand types: string % bool
+Unsupported operand types: bool % string
+Unsupported operand types: string % bool
+Unsupported operand types: bool % string
+Unsupported operand types: string % int
+Unsupported operand types: int % string
+Unsupported operand types: string % float
+Unsupported operand types: float % string
+Unsupported operand types: string % string
+Unsupported operand types: string % string
+Unsupported operand types: string % string
+Warning: A non-numeric value encountered
+Unsupported operand types: string % string
+Unsupported operand types: array ** array
+Unsupported operand types: array ** stdClass
+Unsupported operand types: array ** resource
+Unsupported operand types: array ** string
+Unsupported operand types: stdClass ** array
+Unsupported operand types: stdClass ** stdClass
+Unsupported operand types: stdClass ** resource
+Unsupported operand types: stdClass ** string
+Unsupported operand types: resource ** array
+Unsupported operand types: resource ** stdClass
+Unsupported operand types: resource ** resource
+Unsupported operand types: resource ** string
+Unsupported operand types: string ** array
+Unsupported operand types: string ** stdClass
+Unsupported operand types: string ** resource
+Unsupported operand types: string ** string
+Unsupported operand types: array ** null
+Unsupported operand types: null ** array
+Unsupported operand types: array ** bool
+Unsupported operand types: bool ** array
+Unsupported operand types: array ** bool
+Unsupported operand types: bool ** array
+Unsupported operand types: array ** int
+Unsupported operand types: int ** array
+Unsupported operand types: array ** float
+Unsupported operand types: float ** array
+Unsupported operand types: array ** string
+Unsupported operand types: string ** array
+Unsupported operand types: array ** string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ** array
+Unsupported operand types: stdClass ** null
+Unsupported operand types: null ** stdClass
+Unsupported operand types: stdClass ** bool
+Unsupported operand types: bool ** stdClass
+Unsupported operand types: stdClass ** bool
+Unsupported operand types: bool ** stdClass
+Unsupported operand types: stdClass ** int
+Unsupported operand types: int ** stdClass
+Unsupported operand types: stdClass ** float
+Unsupported operand types: float ** stdClass
+Unsupported operand types: stdClass ** string
+Unsupported operand types: string ** stdClass
+Unsupported operand types: stdClass ** string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ** stdClass
+Unsupported operand types: resource ** null
+Unsupported operand types: null ** resource
+Unsupported operand types: resource ** bool
+Unsupported operand types: bool ** resource
+Unsupported operand types: resource ** bool
+Unsupported operand types: bool ** resource
+Unsupported operand types: resource ** int
+Unsupported operand types: int ** resource
+Unsupported operand types: resource ** float
+Unsupported operand types: float ** resource
+Unsupported operand types: resource ** string
+Unsupported operand types: string ** resource
+Unsupported operand types: resource ** string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ** resource
+Unsupported operand types: string ** null
+Unsupported operand types: null ** string
+Unsupported operand types: string ** bool
+Unsupported operand types: bool ** string
+Unsupported operand types: string ** bool
+Unsupported operand types: bool ** string
+Unsupported operand types: string ** int
+Unsupported operand types: int ** string
+Unsupported operand types: string ** float
+Unsupported operand types: float ** string
+Unsupported operand types: string ** string
+Unsupported operand types: string ** string
+Unsupported operand types: string ** string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ** string
+Unsupported operand types: array << array
+Unsupported operand types: array << stdClass
+Unsupported operand types: array << resource
+Unsupported operand types: array << string
+Unsupported operand types: stdClass << array
+Unsupported operand types: stdClass << stdClass
+Unsupported operand types: stdClass << resource
+Unsupported operand types: stdClass << string
+Unsupported operand types: resource << array
+Unsupported operand types: resource << stdClass
+Unsupported operand types: resource << resource
+Unsupported operand types: resource << string
+Unsupported operand types: string << array
+Unsupported operand types: string << stdClass
+Unsupported operand types: string << resource
+Unsupported operand types: string << string
+Unsupported operand types: array << null
+Unsupported operand types: null << array
+Unsupported operand types: array << bool
+Unsupported operand types: bool << array
+Unsupported operand types: array << bool
+Unsupported operand types: bool << array
+Unsupported operand types: array << int
+Unsupported operand types: int << array
+Unsupported operand types: array << float
+Unsupported operand types: float << array
+Unsupported operand types: array << string
+Unsupported operand types: string << array
+Unsupported operand types: array << string
+Warning: A non-numeric value encountered
+Unsupported operand types: string << array
+Unsupported operand types: stdClass << null
+Unsupported operand types: null << stdClass
+Unsupported operand types: stdClass << bool
+Unsupported operand types: bool << stdClass
+Unsupported operand types: stdClass << bool
+Unsupported operand types: bool << stdClass
+Unsupported operand types: stdClass << int
+Unsupported operand types: int << stdClass
+Unsupported operand types: stdClass << float
+Unsupported operand types: float << stdClass
+Unsupported operand types: stdClass << string
+Unsupported operand types: string << stdClass
+Unsupported operand types: stdClass << string
+Warning: A non-numeric value encountered
+Unsupported operand types: string << stdClass
+Unsupported operand types: resource << null
+Unsupported operand types: null << resource
+Unsupported operand types: resource << bool
+Unsupported operand types: bool << resource
+Unsupported operand types: resource << bool
+Unsupported operand types: bool << resource
+Unsupported operand types: resource << int
+Unsupported operand types: int << resource
+Unsupported operand types: resource << float
+Unsupported operand types: float << resource
+Unsupported operand types: resource << string
+Unsupported operand types: string << resource
+Unsupported operand types: resource << string
+Warning: A non-numeric value encountered
+Unsupported operand types: string << resource
+Unsupported operand types: string << null
+Unsupported operand types: null << string
+Unsupported operand types: string << bool
+Unsupported operand types: bool << string
+Unsupported operand types: string << bool
+Unsupported operand types: bool << string
+Unsupported operand types: string << int
+Unsupported operand types: int << string
+Unsupported operand types: string << float
+Unsupported operand types: float << string
+Unsupported operand types: string << string
+Unsupported operand types: string << string
+Unsupported operand types: string << string
+Warning: A non-numeric value encountered
+Unsupported operand types: string << string
+Unsupported operand types: array >> array
+Unsupported operand types: array >> stdClass
+Unsupported operand types: array >> resource
+Unsupported operand types: array >> string
+Unsupported operand types: stdClass >> array
+Unsupported operand types: stdClass >> stdClass
+Unsupported operand types: stdClass >> resource
+Unsupported operand types: stdClass >> string
+Unsupported operand types: resource >> array
+Unsupported operand types: resource >> stdClass
+Unsupported operand types: resource >> resource
+Unsupported operand types: resource >> string
+Unsupported operand types: string >> array
+Unsupported operand types: string >> stdClass
+Unsupported operand types: string >> resource
+Unsupported operand types: string >> string
+Unsupported operand types: array >> null
+Unsupported operand types: null >> array
+Unsupported operand types: array >> bool
+Unsupported operand types: bool >> array
+Unsupported operand types: array >> bool
+Unsupported operand types: bool >> array
+Unsupported operand types: array >> int
+Unsupported operand types: int >> array
+Unsupported operand types: array >> float
+Unsupported operand types: float >> array
+Unsupported operand types: array >> string
+Unsupported operand types: string >> array
+Unsupported operand types: array >> string
+Warning: A non-numeric value encountered
+Unsupported operand types: string >> array
+Unsupported operand types: stdClass >> null
+Unsupported operand types: null >> stdClass
+Unsupported operand types: stdClass >> bool
+Unsupported operand types: bool >> stdClass
+Unsupported operand types: stdClass >> bool
+Unsupported operand types: bool >> stdClass
+Unsupported operand types: stdClass >> int
+Unsupported operand types: int >> stdClass
+Unsupported operand types: stdClass >> float
+Unsupported operand types: float >> stdClass
+Unsupported operand types: stdClass >> string
+Unsupported operand types: string >> stdClass
+Unsupported operand types: stdClass >> string
+Warning: A non-numeric value encountered
+Unsupported operand types: string >> stdClass
+Unsupported operand types: resource >> null
+Unsupported operand types: null >> resource
+Unsupported operand types: resource >> bool
+Unsupported operand types: bool >> resource
+Unsupported operand types: resource >> bool
+Unsupported operand types: bool >> resource
+Unsupported operand types: resource >> int
+Unsupported operand types: int >> resource
+Unsupported operand types: resource >> float
+Unsupported operand types: float >> resource
+Unsupported operand types: resource >> string
+Unsupported operand types: string >> resource
+Unsupported operand types: resource >> string
+Warning: A non-numeric value encountered
+Unsupported operand types: string >> resource
+Unsupported operand types: string >> null
+Unsupported operand types: null >> string
+Unsupported operand types: string >> bool
+Unsupported operand types: bool >> string
+Unsupported operand types: string >> bool
+Unsupported operand types: bool >> string
+Unsupported operand types: string >> int
+Unsupported operand types: int >> string
+Unsupported operand types: string >> float
+Unsupported operand types: float >> string
+Unsupported operand types: string >> string
+Unsupported operand types: string >> string
+Unsupported operand types: string >> string
+Warning: A non-numeric value encountered
+Unsupported operand types: string >> string
+Unsupported operand types: array & array
+Unsupported operand types: stdClass & array
+Unsupported operand types: resource & array
+Unsupported operand types: array & string
+Unsupported operand types: stdClass & array
+Unsupported operand types: stdClass & stdClass
+Unsupported operand types: stdClass & resource
+Unsupported operand types: stdClass & string
+Unsupported operand types: resource & array
+Unsupported operand types: stdClass & resource
+Unsupported operand types: resource & resource
+Unsupported operand types: resource & string
+Unsupported operand types: string & array
+Unsupported operand types: stdClass & string
+Unsupported operand types: resource & string
+No error for "foo" & "foo"
+Unsupported operand types: array & null
+Unsupported operand types: null & array
+Unsupported operand types: array & bool
+Unsupported operand types: bool & array
+Unsupported operand types: array & bool
+Unsupported operand types: bool & array
+Unsupported operand types: array & int
+Unsupported operand types: int & array
+Unsupported operand types: array & float
+Unsupported operand types: float & array
+Unsupported operand types: array & string
+Unsupported operand types: string & array
+Unsupported operand types: array & string
+Warning: A non-numeric value encountered
+Unsupported operand types: string & array
+Unsupported operand types: stdClass & null
+Unsupported operand types: stdClass & null
+Unsupported operand types: stdClass & bool
+Unsupported operand types: stdClass & bool
+Unsupported operand types: stdClass & bool
+Unsupported operand types: stdClass & bool
+Unsupported operand types: stdClass & int
+Unsupported operand types: stdClass & int
+Unsupported operand types: stdClass & float
+Unsupported operand types: stdClass & float
+Unsupported operand types: stdClass & string
+Unsupported operand types: stdClass & string
+Unsupported operand types: stdClass & string
+Unsupported operand types: stdClass & string
+Unsupported operand types: resource & null
+Unsupported operand types: resource & null
+Unsupported operand types: resource & bool
+Unsupported operand types: resource & bool
+Unsupported operand types: resource & bool
+Unsupported operand types: resource & bool
+Unsupported operand types: resource & int
+Unsupported operand types: resource & int
+Unsupported operand types: resource & float
+Unsupported operand types: resource & float
+Unsupported operand types: resource & string
+Unsupported operand types: resource & string
+Unsupported operand types: resource & string
+Unsupported operand types: resource & string
+Unsupported operand types: string & null
+Unsupported operand types: null & string
+Unsupported operand types: string & bool
+Unsupported operand types: bool & string
+Unsupported operand types: string & bool
+Unsupported operand types: bool & string
+Unsupported operand types: string & int
+Unsupported operand types: int & string
+Unsupported operand types: string & float
+Unsupported operand types: float & string
+No error for "foo" & "123"
+No error for "123" & "foo"
+No error for "foo" & "123foo"
+No error for "123foo" & "foo"
+Unsupported operand types: array | array
+Unsupported operand types: stdClass | array
+Unsupported operand types: resource | array
+Unsupported operand types: array | string
+Unsupported operand types: stdClass | array
+Unsupported operand types: stdClass | stdClass
+Unsupported operand types: stdClass | resource
+Unsupported operand types: stdClass | string
+Unsupported operand types: resource | array
+Unsupported operand types: stdClass | resource
+Unsupported operand types: resource | resource
+Unsupported operand types: resource | string
+Unsupported operand types: string | array
+Unsupported operand types: stdClass | string
+Unsupported operand types: resource | string
+No error for "foo" | "foo"
+Unsupported operand types: array | null
+Unsupported operand types: null | array
+Unsupported operand types: array | bool
+Unsupported operand types: bool | array
+Unsupported operand types: array | bool
+Unsupported operand types: bool | array
+Unsupported operand types: array | int
+Unsupported operand types: int | array
+Unsupported operand types: array | float
+Unsupported operand types: float | array
+Unsupported operand types: array | string
+Unsupported operand types: string | array
+Unsupported operand types: array | string
+Warning: A non-numeric value encountered
+Unsupported operand types: string | array
+Unsupported operand types: stdClass | null
+Unsupported operand types: stdClass | null
+Unsupported operand types: stdClass | bool
+Unsupported operand types: stdClass | bool
+Unsupported operand types: stdClass | bool
+Unsupported operand types: stdClass | bool
+Unsupported operand types: stdClass | int
+Unsupported operand types: stdClass | int
+Unsupported operand types: stdClass | float
+Unsupported operand types: stdClass | float
+Unsupported operand types: stdClass | string
+Unsupported operand types: stdClass | string
+Unsupported operand types: stdClass | string
+Unsupported operand types: stdClass | string
+Unsupported operand types: resource | null
+Unsupported operand types: resource | null
+Unsupported operand types: resource | bool
+Unsupported operand types: resource | bool
+Unsupported operand types: resource | bool
+Unsupported operand types: resource | bool
+Unsupported operand types: resource | int
+Unsupported operand types: resource | int
+Unsupported operand types: resource | float
+Unsupported operand types: resource | float
+Unsupported operand types: resource | string
+Unsupported operand types: resource | string
+Unsupported operand types: resource | string
+Unsupported operand types: resource | string
+Unsupported operand types: string | null
+Unsupported operand types: null | string
+Unsupported operand types: string | bool
+Unsupported operand types: bool | string
+Unsupported operand types: string | bool
+Unsupported operand types: bool | string
+Unsupported operand types: string | int
+Unsupported operand types: int | string
+Unsupported operand types: string | float
+Unsupported operand types: float | string
+No error for "foo" | "123"
+No error for "123" | "foo"
+No error for "foo" | "123foo"
+No error for "123foo" | "foo"
+Unsupported operand types: array ^ array
+Unsupported operand types: stdClass ^ array
+Unsupported operand types: resource ^ array
+Unsupported operand types: array ^ string
+Unsupported operand types: stdClass ^ array
+Unsupported operand types: stdClass ^ stdClass
+Unsupported operand types: stdClass ^ resource
+Unsupported operand types: stdClass ^ string
+Unsupported operand types: resource ^ array
+Unsupported operand types: stdClass ^ resource
+Unsupported operand types: resource ^ resource
+Unsupported operand types: resource ^ string
+Unsupported operand types: string ^ array
+Unsupported operand types: stdClass ^ string
+Unsupported operand types: resource ^ string
+No error for "foo" ^ "foo"
+Unsupported operand types: array ^ null
+Unsupported operand types: null ^ array
+Unsupported operand types: array ^ bool
+Unsupported operand types: bool ^ array
+Unsupported operand types: array ^ bool
+Unsupported operand types: bool ^ array
+Unsupported operand types: array ^ int
+Unsupported operand types: int ^ array
+Unsupported operand types: array ^ float
+Unsupported operand types: float ^ array
+Unsupported operand types: array ^ string
+Unsupported operand types: string ^ array
+Unsupported operand types: array ^ string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ^ array
+Unsupported operand types: stdClass ^ null
+Unsupported operand types: stdClass ^ null
+Unsupported operand types: stdClass ^ bool
+Unsupported operand types: stdClass ^ bool
+Unsupported operand types: stdClass ^ bool
+Unsupported operand types: stdClass ^ bool
+Unsupported operand types: stdClass ^ int
+Unsupported operand types: stdClass ^ int
+Unsupported operand types: stdClass ^ float
+Unsupported operand types: stdClass ^ float
+Unsupported operand types: stdClass ^ string
+Unsupported operand types: stdClass ^ string
+Unsupported operand types: stdClass ^ string
+Unsupported operand types: stdClass ^ string
+Unsupported operand types: resource ^ null
+Unsupported operand types: resource ^ null
+Unsupported operand types: resource ^ bool
+Unsupported operand types: resource ^ bool
+Unsupported operand types: resource ^ bool
+Unsupported operand types: resource ^ bool
+Unsupported operand types: resource ^ int
+Unsupported operand types: resource ^ int
+Unsupported operand types: resource ^ float
+Unsupported operand types: resource ^ float
+Unsupported operand types: resource ^ string
+Unsupported operand types: resource ^ string
+Unsupported operand types: resource ^ string
+Unsupported operand types: resource ^ string
+Unsupported operand types: string ^ null
+Unsupported operand types: null ^ string
+Unsupported operand types: string ^ bool
+Unsupported operand types: bool ^ string
+Unsupported operand types: string ^ bool
+Unsupported operand types: bool ^ string
+Unsupported operand types: string ^ int
+Unsupported operand types: int ^ string
+Unsupported operand types: string ^ float
+Unsupported operand types: float ^ string
+No error for "foo" ^ "123"
+No error for "123" ^ "foo"
+No error for "foo" ^ "123foo"
+No error for "123foo" ^ "foo"
+No error for [] xor []
+No error for [] xor new stdClass
+No error for [] xor STDOUT
+No error for [] xor "foo"
+No error for new stdClass xor []
+No error for new stdClass xor new stdClass
+No error for new stdClass xor STDOUT
+No error for new stdClass xor "foo"
+No error for STDOUT xor []
+No error for STDOUT xor new stdClass
+No error for STDOUT xor STDOUT
+No error for STDOUT xor "foo"
+No error for "foo" xor []
+No error for "foo" xor new stdClass
+No error for "foo" xor STDOUT
+No error for "foo" xor "foo"
+No error for [] xor null
+No error for null xor []
+No error for [] xor true
+No error for true xor []
+No error for [] xor false
+No error for false xor []
+No error for [] xor 2
+No error for 2 xor []
+No error for [] xor 3.5
+No error for 3.5 xor []
+No error for [] xor "123"
+No error for "123" xor []
+No error for [] xor "123foo"
+No error for "123foo" xor []
+No error for new stdClass xor null
+No error for null xor new stdClass
+No error for new stdClass xor true
+No error for true xor new stdClass
+No error for new stdClass xor false
+No error for false xor new stdClass
+No error for new stdClass xor 2
+No error for 2 xor new stdClass
+No error for new stdClass xor 3.5
+No error for 3.5 xor new stdClass
+No error for new stdClass xor "123"
+No error for "123" xor new stdClass
+No error for new stdClass xor "123foo"
+No error for "123foo" xor new stdClass
+No error for STDOUT xor null
+No error for null xor STDOUT
+No error for STDOUT xor true
+No error for true xor STDOUT
+No error for STDOUT xor false
+No error for false xor STDOUT
+No error for STDOUT xor 2
+No error for 2 xor STDOUT
+No error for STDOUT xor 3.5
+No error for 3.5 xor STDOUT
+No error for STDOUT xor "123"
+No error for "123" xor STDOUT
+No error for STDOUT xor "123foo"
+No error for "123foo" xor STDOUT
+No error for "foo" xor null
+No error for null xor "foo"
+No error for "foo" xor true
+No error for true xor "foo"
+No error for "foo" xor false
+No error for false xor "foo"
+No error for "foo" xor 2
+No error for 2 xor "foo"
+No error for "foo" xor 3.5
+No error for 3.5 xor "foo"
+No error for "foo" xor "123"
+No error for "123" xor "foo"
+No error for "foo" xor "123foo"
+No error for "123foo" xor "foo"
+Warning: Array to string conversion
+Warning: Array to string conversion
+No error for [] . []
+Warning: Array to string conversion
+Object of class stdClass could not be converted to string
+Warning: Array to string conversion
+No error for [] . STDOUT
+Warning: Array to string conversion
+No error for [] . "foo"
+Warning: Array to string conversion
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Warning: Array to string conversion
+No error for STDOUT . []
+Object of class stdClass could not be converted to string
+No error for STDOUT . STDOUT
+No error for STDOUT . "foo"
+Warning: Array to string conversion
+No error for "foo" . []
+Object of class stdClass could not be converted to string
+No error for "foo" . STDOUT
+No error for "foo" . "foo"
+Warning: Array to string conversion
+No error for [] . null
+Warning: Array to string conversion
+No error for null . []
+Warning: Array to string conversion
+No error for [] . true
+Warning: Array to string conversion
+No error for true . []
+Warning: Array to string conversion
+No error for [] . false
+Warning: Array to string conversion
+No error for false . []
+Warning: Array to string conversion
+No error for [] . 2
+Warning: Array to string conversion
+No error for 2 . []
+Warning: Array to string conversion
+No error for [] . 3.5
+Warning: Array to string conversion
+No error for 3.5 . []
+Warning: Array to string conversion
+No error for [] . "123"
+Warning: Array to string conversion
+No error for "123" . []
+Warning: Array to string conversion
+No error for [] . "123foo"
+Warning: Array to string conversion
+No error for "123foo" . []
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+No error for STDOUT . null
+No error for null . STDOUT
+No error for STDOUT . true
+No error for true . STDOUT
+No error for STDOUT . false
+No error for false . STDOUT
+No error for STDOUT . 2
+No error for 2 . STDOUT
+No error for STDOUT . 3.5
+No error for 3.5 . STDOUT
+No error for STDOUT . "123"
+No error for "123" . STDOUT
+No error for STDOUT . "123foo"
+No error for "123foo" . STDOUT
+No error for "foo" . null
+No error for null . "foo"
+No error for "foo" . true
+No error for true . "foo"
+No error for "foo" . false
+No error for false . "foo"
+No error for "foo" . 2
+No error for 2 . "foo"
+No error for "foo" . 3.5
+No error for 3.5 . "foo"
+No error for "foo" . "123"
+No error for "123" . "foo"
+No error for "foo" . "123foo"
+No error for "123foo" . "foo"
+
+
+ASSIGN OP:
+No error for [] += []
+Unsupported operand types: array + stdClass
+Unsupported operand types: array + resource
+Unsupported operand types: array + string
+Unsupported operand types: stdClass + array
+Unsupported operand types: stdClass + stdClass
+Unsupported operand types: stdClass + resource
+Unsupported operand types: stdClass + string
+Unsupported operand types: resource + array
+Unsupported operand types: resource + stdClass
+Unsupported operand types: resource + resource
+Unsupported operand types: resource + string
+Unsupported operand types: string + array
+Unsupported operand types: string + stdClass
+Unsupported operand types: string + resource
+Unsupported operand types: string + string
+Unsupported operand types: array + null
+Unsupported operand types: null + array
+Unsupported operand types: array + bool
+Unsupported operand types: bool + array
+Unsupported operand types: array + bool
+Unsupported operand types: bool + array
+Unsupported operand types: array + int
+Unsupported operand types: int + array
+Unsupported operand types: array + float
+Unsupported operand types: float + array
+Unsupported operand types: array + string
+Unsupported operand types: string + array
+Unsupported operand types: array + string
+Warning: A non-numeric value encountered
+Unsupported operand types: string + array
+Unsupported operand types: stdClass + null
+Unsupported operand types: null + stdClass
+Unsupported operand types: stdClass + bool
+Unsupported operand types: bool + stdClass
+Unsupported operand types: stdClass + bool
+Unsupported operand types: bool + stdClass
+Unsupported operand types: stdClass + int
+Unsupported operand types: int + stdClass
+Unsupported operand types: stdClass + float
+Unsupported operand types: float + stdClass
+Unsupported operand types: stdClass + string
+Unsupported operand types: string + stdClass
+Unsupported operand types: stdClass + string
+Warning: A non-numeric value encountered
+Unsupported operand types: string + stdClass
+Unsupported operand types: resource + null
+Unsupported operand types: null + resource
+Unsupported operand types: resource + bool
+Unsupported operand types: bool + resource
+Unsupported operand types: resource + bool
+Unsupported operand types: bool + resource
+Unsupported operand types: resource + int
+Unsupported operand types: int + resource
+Unsupported operand types: resource + float
+Unsupported operand types: float + resource
+Unsupported operand types: resource + string
+Unsupported operand types: string + resource
+Unsupported operand types: resource + string
+Warning: A non-numeric value encountered
+Unsupported operand types: string + resource
+Unsupported operand types: string + null
+Unsupported operand types: null + string
+Unsupported operand types: string + bool
+Unsupported operand types: bool + string
+Unsupported operand types: string + bool
+Unsupported operand types: bool + string
+Unsupported operand types: string + int
+Unsupported operand types: int + string
+Unsupported operand types: string + float
+Unsupported operand types: float + string
+Unsupported operand types: string + string
+Unsupported operand types: string + string
+Unsupported operand types: string + string
+Warning: A non-numeric value encountered
+Unsupported operand types: string + string
+Unsupported operand types: array - array
+Unsupported operand types: array - stdClass
+Unsupported operand types: array - resource
+Unsupported operand types: array - string
+Unsupported operand types: stdClass - array
+Unsupported operand types: stdClass - stdClass
+Unsupported operand types: stdClass - resource
+Unsupported operand types: stdClass - string
+Unsupported operand types: resource - array
+Unsupported operand types: resource - stdClass
+Unsupported operand types: resource - resource
+Unsupported operand types: resource - string
+Unsupported operand types: string - array
+Unsupported operand types: string - stdClass
+Unsupported operand types: string - resource
+Unsupported operand types: string - string
+Unsupported operand types: array - null
+Unsupported operand types: null - array
+Unsupported operand types: array - bool
+Unsupported operand types: bool - array
+Unsupported operand types: array - bool
+Unsupported operand types: bool - array
+Unsupported operand types: array - int
+Unsupported operand types: int - array
+Unsupported operand types: array - float
+Unsupported operand types: float - array
+Unsupported operand types: array - string
+Unsupported operand types: string - array
+Unsupported operand types: array - string
+Warning: A non-numeric value encountered
+Unsupported operand types: string - array
+Unsupported operand types: stdClass - null
+Unsupported operand types: null - stdClass
+Unsupported operand types: stdClass - bool
+Unsupported operand types: bool - stdClass
+Unsupported operand types: stdClass - bool
+Unsupported operand types: bool - stdClass
+Unsupported operand types: stdClass - int
+Unsupported operand types: int - stdClass
+Unsupported operand types: stdClass - float
+Unsupported operand types: float - stdClass
+Unsupported operand types: stdClass - string
+Unsupported operand types: string - stdClass
+Unsupported operand types: stdClass - string
+Warning: A non-numeric value encountered
+Unsupported operand types: string - stdClass
+Unsupported operand types: resource - null
+Unsupported operand types: null - resource
+Unsupported operand types: resource - bool
+Unsupported operand types: bool - resource
+Unsupported operand types: resource - bool
+Unsupported operand types: bool - resource
+Unsupported operand types: resource - int
+Unsupported operand types: int - resource
+Unsupported operand types: resource - float
+Unsupported operand types: float - resource
+Unsupported operand types: resource - string
+Unsupported operand types: string - resource
+Unsupported operand types: resource - string
+Warning: A non-numeric value encountered
+Unsupported operand types: string - resource
+Unsupported operand types: string - null
+Unsupported operand types: null - string
+Unsupported operand types: string - bool
+Unsupported operand types: bool - string
+Unsupported operand types: string - bool
+Unsupported operand types: bool - string
+Unsupported operand types: string - int
+Unsupported operand types: int - string
+Unsupported operand types: string - float
+Unsupported operand types: float - string
+Unsupported operand types: string - string
+Unsupported operand types: string - string
+Unsupported operand types: string - string
+Warning: A non-numeric value encountered
+Unsupported operand types: string - string
+Unsupported operand types: array * array
+Unsupported operand types: array * stdClass
+Unsupported operand types: array * resource
+Unsupported operand types: array * string
+Unsupported operand types: stdClass * array
+Unsupported operand types: stdClass * stdClass
+Unsupported operand types: stdClass * resource
+Unsupported operand types: stdClass * string
+Unsupported operand types: resource * array
+Unsupported operand types: resource * stdClass
+Unsupported operand types: resource * resource
+Unsupported operand types: resource * string
+Unsupported operand types: string * array
+Unsupported operand types: string * stdClass
+Unsupported operand types: string * resource
+Unsupported operand types: string * string
+Unsupported operand types: array * null
+Unsupported operand types: null * array
+Unsupported operand types: array * bool
+Unsupported operand types: bool * array
+Unsupported operand types: array * bool
+Unsupported operand types: bool * array
+Unsupported operand types: array * int
+Unsupported operand types: int * array
+Unsupported operand types: array * float
+Unsupported operand types: float * array
+Unsupported operand types: array * string
+Unsupported operand types: string * array
+Unsupported operand types: array * string
+Warning: A non-numeric value encountered
+Unsupported operand types: string * array
+Unsupported operand types: stdClass * null
+Unsupported operand types: null * stdClass
+Unsupported operand types: stdClass * bool
+Unsupported operand types: bool * stdClass
+Unsupported operand types: stdClass * bool
+Unsupported operand types: bool * stdClass
+Unsupported operand types: stdClass * int
+Unsupported operand types: int * stdClass
+Unsupported operand types: stdClass * float
+Unsupported operand types: float * stdClass
+Unsupported operand types: stdClass * string
+Unsupported operand types: string * stdClass
+Unsupported operand types: stdClass * string
+Warning: A non-numeric value encountered
+Unsupported operand types: string * stdClass
+Unsupported operand types: resource * null
+Unsupported operand types: null * resource
+Unsupported operand types: resource * bool
+Unsupported operand types: bool * resource
+Unsupported operand types: resource * bool
+Unsupported operand types: bool * resource
+Unsupported operand types: resource * int
+Unsupported operand types: int * resource
+Unsupported operand types: resource * float
+Unsupported operand types: float * resource
+Unsupported operand types: resource * string
+Unsupported operand types: string * resource
+Unsupported operand types: resource * string
+Warning: A non-numeric value encountered
+Unsupported operand types: string * resource
+Unsupported operand types: string * null
+Unsupported operand types: null * string
+Unsupported operand types: string * bool
+Unsupported operand types: bool * string
+Unsupported operand types: string * bool
+Unsupported operand types: bool * string
+Unsupported operand types: string * int
+Unsupported operand types: int * string
+Unsupported operand types: string * float
+Unsupported operand types: float * string
+Unsupported operand types: string * string
+Unsupported operand types: string * string
+Unsupported operand types: string * string
+Warning: A non-numeric value encountered
+Unsupported operand types: string * string
+Unsupported operand types: array / array
+Unsupported operand types: array / stdClass
+Unsupported operand types: array / resource
+Unsupported operand types: array / string
+Unsupported operand types: stdClass / array
+Unsupported operand types: stdClass / stdClass
+Unsupported operand types: stdClass / resource
+Unsupported operand types: stdClass / string
+Unsupported operand types: resource / array
+Unsupported operand types: resource / stdClass
+Unsupported operand types: resource / resource
+Unsupported operand types: resource / string
+Unsupported operand types: string / array
+Unsupported operand types: string / stdClass
+Unsupported operand types: string / resource
+Unsupported operand types: string / string
+Unsupported operand types: array / null
+Unsupported operand types: null / array
+Unsupported operand types: array / bool
+Unsupported operand types: bool / array
+Unsupported operand types: array / bool
+Unsupported operand types: bool / array
+Unsupported operand types: array / int
+Unsupported operand types: int / array
+Unsupported operand types: array / float
+Unsupported operand types: float / array
+Unsupported operand types: array / string
+Unsupported operand types: string / array
+Unsupported operand types: array / string
+Warning: A non-numeric value encountered
+Unsupported operand types: string / array
+Unsupported operand types: stdClass / null
+Unsupported operand types: null / stdClass
+Unsupported operand types: stdClass / bool
+Unsupported operand types: bool / stdClass
+Unsupported operand types: stdClass / bool
+Unsupported operand types: bool / stdClass
+Unsupported operand types: stdClass / int
+Unsupported operand types: int / stdClass
+Unsupported operand types: stdClass / float
+Unsupported operand types: float / stdClass
+Unsupported operand types: stdClass / string
+Unsupported operand types: string / stdClass
+Unsupported operand types: stdClass / string
+Warning: A non-numeric value encountered
+Unsupported operand types: string / stdClass
+Unsupported operand types: resource / null
+Unsupported operand types: null / resource
+Unsupported operand types: resource / bool
+Unsupported operand types: bool / resource
+Unsupported operand types: resource / bool
+Unsupported operand types: bool / resource
+Unsupported operand types: resource / int
+Unsupported operand types: int / resource
+Unsupported operand types: resource / float
+Unsupported operand types: float / resource
+Unsupported operand types: resource / string
+Unsupported operand types: string / resource
+Unsupported operand types: resource / string
+Warning: A non-numeric value encountered
+Unsupported operand types: string / resource
+Unsupported operand types: string / null
+Unsupported operand types: null / string
+Unsupported operand types: string / bool
+Unsupported operand types: bool / string
+Unsupported operand types: string / bool
+Unsupported operand types: bool / string
+Unsupported operand types: string / int
+Unsupported operand types: int / string
+Unsupported operand types: string / float
+Unsupported operand types: float / string
+Unsupported operand types: string / string
+Unsupported operand types: string / string
+Unsupported operand types: string / string
+Warning: A non-numeric value encountered
+Unsupported operand types: string / string
+Unsupported operand types: array % array
+Unsupported operand types: array % stdClass
+Unsupported operand types: array % resource
+Unsupported operand types: array % string
+Unsupported operand types: stdClass % array
+Unsupported operand types: stdClass % stdClass
+Unsupported operand types: stdClass % resource
+Unsupported operand types: stdClass % string
+Unsupported operand types: resource % array
+Unsupported operand types: resource % stdClass
+Unsupported operand types: resource % resource
+Unsupported operand types: resource % string
+Unsupported operand types: string % array
+Unsupported operand types: string % stdClass
+Unsupported operand types: string % resource
+Unsupported operand types: string % string
+Unsupported operand types: array % null
+Unsupported operand types: null % array
+Unsupported operand types: array % bool
+Unsupported operand types: bool % array
+Unsupported operand types: array % bool
+Unsupported operand types: bool % array
+Unsupported operand types: array % int
+Unsupported operand types: int % array
+Unsupported operand types: array % float
+Unsupported operand types: float % array
+Unsupported operand types: array % string
+Unsupported operand types: string % array
+Unsupported operand types: array % string
+Warning: A non-numeric value encountered
+Unsupported operand types: string % array
+Unsupported operand types: stdClass % null
+Unsupported operand types: null % stdClass
+Unsupported operand types: stdClass % bool
+Unsupported operand types: bool % stdClass
+Unsupported operand types: stdClass % bool
+Unsupported operand types: bool % stdClass
+Unsupported operand types: stdClass % int
+Unsupported operand types: int % stdClass
+Unsupported operand types: stdClass % float
+Unsupported operand types: float % stdClass
+Unsupported operand types: stdClass % string
+Unsupported operand types: string % stdClass
+Unsupported operand types: stdClass % string
+Warning: A non-numeric value encountered
+Unsupported operand types: string % stdClass
+Unsupported operand types: resource % null
+Unsupported operand types: null % resource
+Unsupported operand types: resource % bool
+Unsupported operand types: bool % resource
+Unsupported operand types: resource % bool
+Unsupported operand types: bool % resource
+Unsupported operand types: resource % int
+Unsupported operand types: int % resource
+Unsupported operand types: resource % float
+Unsupported operand types: float % resource
+Unsupported operand types: resource % string
+Unsupported operand types: string % resource
+Unsupported operand types: resource % string
+Warning: A non-numeric value encountered
+Unsupported operand types: string % resource
+Unsupported operand types: string % null
+Unsupported operand types: null % string
+Unsupported operand types: string % bool
+Unsupported operand types: bool % string
+Unsupported operand types: string % bool
+Unsupported operand types: bool % string
+Unsupported operand types: string % int
+Unsupported operand types: int % string
+Unsupported operand types: string % float
+Unsupported operand types: float % string
+Unsupported operand types: string % string
+Unsupported operand types: string % string
+Unsupported operand types: string % string
+Warning: A non-numeric value encountered
+Unsupported operand types: string % string
+Unsupported operand types: array ** array
+Unsupported operand types: array ** stdClass
+Unsupported operand types: array ** resource
+Unsupported operand types: array ** string
+Unsupported operand types: stdClass ** array
+Unsupported operand types: stdClass ** stdClass
+Unsupported operand types: stdClass ** resource
+Unsupported operand types: stdClass ** string
+Unsupported operand types: resource ** array
+Unsupported operand types: resource ** stdClass
+Unsupported operand types: resource ** resource
+Unsupported operand types: resource ** string
+Unsupported operand types: string ** array
+Unsupported operand types: string ** stdClass
+Unsupported operand types: string ** resource
+Unsupported operand types: string ** string
+Unsupported operand types: array ** null
+Unsupported operand types: null ** array
+Unsupported operand types: array ** bool
+Unsupported operand types: bool ** array
+Unsupported operand types: array ** bool
+Unsupported operand types: bool ** array
+Unsupported operand types: array ** int
+Unsupported operand types: int ** array
+Unsupported operand types: array ** float
+Unsupported operand types: float ** array
+Unsupported operand types: array ** string
+Unsupported operand types: string ** array
+Unsupported operand types: array ** string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ** array
+Unsupported operand types: stdClass ** null
+Unsupported operand types: null ** stdClass
+Unsupported operand types: stdClass ** bool
+Unsupported operand types: bool ** stdClass
+Unsupported operand types: stdClass ** bool
+Unsupported operand types: bool ** stdClass
+Unsupported operand types: stdClass ** int
+Unsupported operand types: int ** stdClass
+Unsupported operand types: stdClass ** float
+Unsupported operand types: float ** stdClass
+Unsupported operand types: stdClass ** string
+Unsupported operand types: string ** stdClass
+Unsupported operand types: stdClass ** string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ** stdClass
+Unsupported operand types: resource ** null
+Unsupported operand types: null ** resource
+Unsupported operand types: resource ** bool
+Unsupported operand types: bool ** resource
+Unsupported operand types: resource ** bool
+Unsupported operand types: bool ** resource
+Unsupported operand types: resource ** int
+Unsupported operand types: int ** resource
+Unsupported operand types: resource ** float
+Unsupported operand types: float ** resource
+Unsupported operand types: resource ** string
+Unsupported operand types: string ** resource
+Unsupported operand types: resource ** string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ** resource
+Unsupported operand types: string ** null
+Unsupported operand types: null ** string
+Unsupported operand types: string ** bool
+Unsupported operand types: bool ** string
+Unsupported operand types: string ** bool
+Unsupported operand types: bool ** string
+Unsupported operand types: string ** int
+Unsupported operand types: int ** string
+Unsupported operand types: string ** float
+Unsupported operand types: float ** string
+Unsupported operand types: string ** string
+Unsupported operand types: string ** string
+Unsupported operand types: string ** string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ** string
+Unsupported operand types: array << array
+Unsupported operand types: array << stdClass
+Unsupported operand types: array << resource
+Unsupported operand types: array << string
+Unsupported operand types: stdClass << array
+Unsupported operand types: stdClass << stdClass
+Unsupported operand types: stdClass << resource
+Unsupported operand types: stdClass << string
+Unsupported operand types: resource << array
+Unsupported operand types: resource << stdClass
+Unsupported operand types: resource << resource
+Unsupported operand types: resource << string
+Unsupported operand types: string << array
+Unsupported operand types: string << stdClass
+Unsupported operand types: string << resource
+Unsupported operand types: string << string
+Unsupported operand types: array << null
+Unsupported operand types: null << array
+Unsupported operand types: array << bool
+Unsupported operand types: bool << array
+Unsupported operand types: array << bool
+Unsupported operand types: bool << array
+Unsupported operand types: array << int
+Unsupported operand types: int << array
+Unsupported operand types: array << float
+Unsupported operand types: float << array
+Unsupported operand types: array << string
+Unsupported operand types: string << array
+Unsupported operand types: array << string
+Warning: A non-numeric value encountered
+Unsupported operand types: string << array
+Unsupported operand types: stdClass << null
+Unsupported operand types: null << stdClass
+Unsupported operand types: stdClass << bool
+Unsupported operand types: bool << stdClass
+Unsupported operand types: stdClass << bool
+Unsupported operand types: bool << stdClass
+Unsupported operand types: stdClass << int
+Unsupported operand types: int << stdClass
+Unsupported operand types: stdClass << float
+Unsupported operand types: float << stdClass
+Unsupported operand types: stdClass << string
+Unsupported operand types: string << stdClass
+Unsupported operand types: stdClass << string
+Warning: A non-numeric value encountered
+Unsupported operand types: string << stdClass
+Unsupported operand types: resource << null
+Unsupported operand types: null << resource
+Unsupported operand types: resource << bool
+Unsupported operand types: bool << resource
+Unsupported operand types: resource << bool
+Unsupported operand types: bool << resource
+Unsupported operand types: resource << int
+Unsupported operand types: int << resource
+Unsupported operand types: resource << float
+Unsupported operand types: float << resource
+Unsupported operand types: resource << string
+Unsupported operand types: string << resource
+Unsupported operand types: resource << string
+Warning: A non-numeric value encountered
+Unsupported operand types: string << resource
+Unsupported operand types: string << null
+Unsupported operand types: null << string
+Unsupported operand types: string << bool
+Unsupported operand types: bool << string
+Unsupported operand types: string << bool
+Unsupported operand types: bool << string
+Unsupported operand types: string << int
+Unsupported operand types: int << string
+Unsupported operand types: string << float
+Unsupported operand types: float << string
+Unsupported operand types: string << string
+Unsupported operand types: string << string
+Unsupported operand types: string << string
+Warning: A non-numeric value encountered
+Unsupported operand types: string << string
+Unsupported operand types: array >> array
+Unsupported operand types: array >> stdClass
+Unsupported operand types: array >> resource
+Unsupported operand types: array >> string
+Unsupported operand types: stdClass >> array
+Unsupported operand types: stdClass >> stdClass
+Unsupported operand types: stdClass >> resource
+Unsupported operand types: stdClass >> string
+Unsupported operand types: resource >> array
+Unsupported operand types: resource >> stdClass
+Unsupported operand types: resource >> resource
+Unsupported operand types: resource >> string
+Unsupported operand types: string >> array
+Unsupported operand types: string >> stdClass
+Unsupported operand types: string >> resource
+Unsupported operand types: string >> string
+Unsupported operand types: array >> null
+Unsupported operand types: null >> array
+Unsupported operand types: array >> bool
+Unsupported operand types: bool >> array
+Unsupported operand types: array >> bool
+Unsupported operand types: bool >> array
+Unsupported operand types: array >> int
+Unsupported operand types: int >> array
+Unsupported operand types: array >> float
+Unsupported operand types: float >> array
+Unsupported operand types: array >> string
+Unsupported operand types: string >> array
+Unsupported operand types: array >> string
+Warning: A non-numeric value encountered
+Unsupported operand types: string >> array
+Unsupported operand types: stdClass >> null
+Unsupported operand types: null >> stdClass
+Unsupported operand types: stdClass >> bool
+Unsupported operand types: bool >> stdClass
+Unsupported operand types: stdClass >> bool
+Unsupported operand types: bool >> stdClass
+Unsupported operand types: stdClass >> int
+Unsupported operand types: int >> stdClass
+Unsupported operand types: stdClass >> float
+Unsupported operand types: float >> stdClass
+Unsupported operand types: stdClass >> string
+Unsupported operand types: string >> stdClass
+Unsupported operand types: stdClass >> string
+Warning: A non-numeric value encountered
+Unsupported operand types: string >> stdClass
+Unsupported operand types: resource >> null
+Unsupported operand types: null >> resource
+Unsupported operand types: resource >> bool
+Unsupported operand types: bool >> resource
+Unsupported operand types: resource >> bool
+Unsupported operand types: bool >> resource
+Unsupported operand types: resource >> int
+Unsupported operand types: int >> resource
+Unsupported operand types: resource >> float
+Unsupported operand types: float >> resource
+Unsupported operand types: resource >> string
+Unsupported operand types: string >> resource
+Unsupported operand types: resource >> string
+Warning: A non-numeric value encountered
+Unsupported operand types: string >> resource
+Unsupported operand types: string >> null
+Unsupported operand types: null >> string
+Unsupported operand types: string >> bool
+Unsupported operand types: bool >> string
+Unsupported operand types: string >> bool
+Unsupported operand types: bool >> string
+Unsupported operand types: string >> int
+Unsupported operand types: int >> string
+Unsupported operand types: string >> float
+Unsupported operand types: float >> string
+Unsupported operand types: string >> string
+Unsupported operand types: string >> string
+Unsupported operand types: string >> string
+Warning: A non-numeric value encountered
+Unsupported operand types: string >> string
+Unsupported operand types: array & array
+Unsupported operand types: array & stdClass
+Unsupported operand types: array & resource
+Unsupported operand types: array & string
+Unsupported operand types: stdClass & array
+Unsupported operand types: stdClass & stdClass
+Unsupported operand types: stdClass & resource
+Unsupported operand types: stdClass & string
+Unsupported operand types: resource & array
+Unsupported operand types: resource & stdClass
+Unsupported operand types: resource & resource
+Unsupported operand types: resource & string
+Unsupported operand types: string & array
+Unsupported operand types: string & stdClass
+Unsupported operand types: string & resource
+No error for "foo" &= "foo"
+Unsupported operand types: array & null
+Unsupported operand types: null & array
+Unsupported operand types: array & bool
+Unsupported operand types: bool & array
+Unsupported operand types: array & bool
+Unsupported operand types: bool & array
+Unsupported operand types: array & int
+Unsupported operand types: int & array
+Unsupported operand types: array & float
+Unsupported operand types: float & array
+Unsupported operand types: array & string
+Unsupported operand types: string & array
+Unsupported operand types: array & string
+Warning: A non-numeric value encountered
+Unsupported operand types: string & array
+Unsupported operand types: stdClass & null
+Unsupported operand types: null & stdClass
+Unsupported operand types: stdClass & bool
+Unsupported operand types: bool & stdClass
+Unsupported operand types: stdClass & bool
+Unsupported operand types: bool & stdClass
+Unsupported operand types: stdClass & int
+Unsupported operand types: int & stdClass
+Unsupported operand types: stdClass & float
+Unsupported operand types: float & stdClass
+Unsupported operand types: stdClass & string
+Unsupported operand types: string & stdClass
+Unsupported operand types: stdClass & string
+Warning: A non-numeric value encountered
+Unsupported operand types: string & stdClass
+Unsupported operand types: resource & null
+Unsupported operand types: null & resource
+Unsupported operand types: resource & bool
+Unsupported operand types: bool & resource
+Unsupported operand types: resource & bool
+Unsupported operand types: bool & resource
+Unsupported operand types: resource & int
+Unsupported operand types: int & resource
+Unsupported operand types: resource & float
+Unsupported operand types: float & resource
+Unsupported operand types: resource & string
+Unsupported operand types: string & resource
+Unsupported operand types: resource & string
+Warning: A non-numeric value encountered
+Unsupported operand types: string & resource
+Unsupported operand types: string & null
+Unsupported operand types: null & string
+Unsupported operand types: string & bool
+Unsupported operand types: bool & string
+Unsupported operand types: string & bool
+Unsupported operand types: bool & string
+Unsupported operand types: string & int
+Unsupported operand types: int & string
+Unsupported operand types: string & float
+Unsupported operand types: float & string
+No error for "foo" &= "123"
+No error for "123" &= "foo"
+No error for "foo" &= "123foo"
+No error for "123foo" &= "foo"
+Unsupported operand types: array | array
+Unsupported operand types: array | stdClass
+Unsupported operand types: array | resource
+Unsupported operand types: array | string
+Unsupported operand types: stdClass | array
+Unsupported operand types: stdClass | stdClass
+Unsupported operand types: stdClass | resource
+Unsupported operand types: stdClass | string
+Unsupported operand types: resource | array
+Unsupported operand types: resource | stdClass
+Unsupported operand types: resource | resource
+Unsupported operand types: resource | string
+Unsupported operand types: string | array
+Unsupported operand types: string | stdClass
+Unsupported operand types: string | resource
+No error for "foo" |= "foo"
+Unsupported operand types: array | null
+Unsupported operand types: null | array
+Unsupported operand types: array | bool
+Unsupported operand types: bool | array
+Unsupported operand types: array | bool
+Unsupported operand types: bool | array
+Unsupported operand types: array | int
+Unsupported operand types: int | array
+Unsupported operand types: array | float
+Unsupported operand types: float | array
+Unsupported operand types: array | string
+Unsupported operand types: string | array
+Unsupported operand types: array | string
+Warning: A non-numeric value encountered
+Unsupported operand types: string | array
+Unsupported operand types: stdClass | null
+Unsupported operand types: null | stdClass
+Unsupported operand types: stdClass | bool
+Unsupported operand types: bool | stdClass
+Unsupported operand types: stdClass | bool
+Unsupported operand types: bool | stdClass
+Unsupported operand types: stdClass | int
+Unsupported operand types: int | stdClass
+Unsupported operand types: stdClass | float
+Unsupported operand types: float | stdClass
+Unsupported operand types: stdClass | string
+Unsupported operand types: string | stdClass
+Unsupported operand types: stdClass | string
+Warning: A non-numeric value encountered
+Unsupported operand types: string | stdClass
+Unsupported operand types: resource | null
+Unsupported operand types: null | resource
+Unsupported operand types: resource | bool
+Unsupported operand types: bool | resource
+Unsupported operand types: resource | bool
+Unsupported operand types: bool | resource
+Unsupported operand types: resource | int
+Unsupported operand types: int | resource
+Unsupported operand types: resource | float
+Unsupported operand types: float | resource
+Unsupported operand types: resource | string
+Unsupported operand types: string | resource
+Unsupported operand types: resource | string
+Warning: A non-numeric value encountered
+Unsupported operand types: string | resource
+Unsupported operand types: string | null
+Unsupported operand types: null | string
+Unsupported operand types: string | bool
+Unsupported operand types: bool | string
+Unsupported operand types: string | bool
+Unsupported operand types: bool | string
+Unsupported operand types: string | int
+Unsupported operand types: int | string
+Unsupported operand types: string | float
+Unsupported operand types: float | string
+No error for "foo" |= "123"
+No error for "123" |= "foo"
+No error for "foo" |= "123foo"
+No error for "123foo" |= "foo"
+Unsupported operand types: array ^ array
+Unsupported operand types: array ^ stdClass
+Unsupported operand types: array ^ resource
+Unsupported operand types: array ^ string
+Unsupported operand types: stdClass ^ array
+Unsupported operand types: stdClass ^ stdClass
+Unsupported operand types: stdClass ^ resource
+Unsupported operand types: stdClass ^ string
+Unsupported operand types: resource ^ array
+Unsupported operand types: resource ^ stdClass
+Unsupported operand types: resource ^ resource
+Unsupported operand types: resource ^ string
+Unsupported operand types: string ^ array
+Unsupported operand types: string ^ stdClass
+Unsupported operand types: string ^ resource
+No error for "foo" ^= "foo"
+Unsupported operand types: array ^ null
+Unsupported operand types: null ^ array
+Unsupported operand types: array ^ bool
+Unsupported operand types: bool ^ array
+Unsupported operand types: array ^ bool
+Unsupported operand types: bool ^ array
+Unsupported operand types: array ^ int
+Unsupported operand types: int ^ array
+Unsupported operand types: array ^ float
+Unsupported operand types: float ^ array
+Unsupported operand types: array ^ string
+Unsupported operand types: string ^ array
+Unsupported operand types: array ^ string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ^ array
+Unsupported operand types: stdClass ^ null
+Unsupported operand types: null ^ stdClass
+Unsupported operand types: stdClass ^ bool
+Unsupported operand types: bool ^ stdClass
+Unsupported operand types: stdClass ^ bool
+Unsupported operand types: bool ^ stdClass
+Unsupported operand types: stdClass ^ int
+Unsupported operand types: int ^ stdClass
+Unsupported operand types: stdClass ^ float
+Unsupported operand types: float ^ stdClass
+Unsupported operand types: stdClass ^ string
+Unsupported operand types: string ^ stdClass
+Unsupported operand types: stdClass ^ string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ^ stdClass
+Unsupported operand types: resource ^ null
+Unsupported operand types: null ^ resource
+Unsupported operand types: resource ^ bool
+Unsupported operand types: bool ^ resource
+Unsupported operand types: resource ^ bool
+Unsupported operand types: bool ^ resource
+Unsupported operand types: resource ^ int
+Unsupported operand types: int ^ resource
+Unsupported operand types: resource ^ float
+Unsupported operand types: float ^ resource
+Unsupported operand types: resource ^ string
+Unsupported operand types: string ^ resource
+Unsupported operand types: resource ^ string
+Warning: A non-numeric value encountered
+Unsupported operand types: string ^ resource
+Unsupported operand types: string ^ null
+Unsupported operand types: null ^ string
+Unsupported operand types: string ^ bool
+Unsupported operand types: bool ^ string
+Unsupported operand types: string ^ bool
+Unsupported operand types: bool ^ string
+Unsupported operand types: string ^ int
+Unsupported operand types: int ^ string
+Unsupported operand types: string ^ float
+Unsupported operand types: float ^ string
+No error for "foo" ^= "123"
+No error for "123" ^= "foo"
+No error for "foo" ^= "123foo"
+No error for "123foo" ^= "foo"
+Warning: Array to string conversion
+Warning: Array to string conversion
+No error for [] .= []
+Warning: Array to string conversion
+Object of class stdClass could not be converted to string
+Warning: Array to string conversion
+No error for [] .= STDOUT
+Warning: Array to string conversion
+No error for [] .= "foo"
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Warning: Array to string conversion
+No error for STDOUT .= []
+Object of class stdClass could not be converted to string
+No error for STDOUT .= STDOUT
+No error for STDOUT .= "foo"
+Warning: Array to string conversion
+No error for "foo" .= []
+Object of class stdClass could not be converted to string
+No error for "foo" .= STDOUT
+No error for "foo" .= "foo"
+Warning: Array to string conversion
+No error for [] .= null
+Warning: Array to string conversion
+No error for null .= []
+Warning: Array to string conversion
+No error for [] .= true
+Warning: Array to string conversion
+No error for true .= []
+Warning: Array to string conversion
+No error for [] .= false
+Warning: Array to string conversion
+No error for false .= []
+Warning: Array to string conversion
+No error for [] .= 2
+Warning: Array to string conversion
+No error for 2 .= []
+Warning: Array to string conversion
+No error for [] .= 3.5
+Warning: Array to string conversion
+No error for 3.5 .= []
+Warning: Array to string conversion
+No error for [] .= "123"
+Warning: Array to string conversion
+No error for "123" .= []
+Warning: Array to string conversion
+No error for [] .= "123foo"
+Warning: Array to string conversion
+No error for "123foo" .= []
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+Object of class stdClass could not be converted to string
+No error for STDOUT .= null
+No error for null .= STDOUT
+No error for STDOUT .= true
+No error for true .= STDOUT
+No error for STDOUT .= false
+No error for false .= STDOUT
+No error for STDOUT .= 2
+No error for 2 .= STDOUT
+No error for STDOUT .= 3.5
+No error for 3.5 .= STDOUT
+No error for STDOUT .= "123"
+No error for "123" .= STDOUT
+No error for STDOUT .= "123foo"
+No error for "123foo" .= STDOUT
+No error for "foo" .= null
+No error for null .= "foo"
+No error for "foo" .= true
+No error for true .= "foo"
+No error for "foo" .= false
+No error for false .= "foo"
+No error for "foo" .= 2
+No error for 2 .= "foo"
+No error for "foo" .= 3.5
+No error for 3.5 .= "foo"
+No error for "foo" .= "123"
+No error for "123" .= "foo"
+No error for "foo" .= "123foo"
+No error for "123foo" .= "foo"
+
+
+UNARY OP:
+Cannot perform bitwise not on array
+Cannot perform bitwise not on stdClass
+Cannot perform bitwise not on resource
+No error for ~"foo"
+
+
+INCDEC:
+Cannot increment array
+Cannot decrement array
+Cannot increment stdClass
+Cannot decrement stdClass
+Cannot increment resource
+Cannot decrement resource
+No error for fop++
+No error for foo--
diff --git a/Zend/tests/output_started_at_eval.phpt b/Zend/tests/output_started_at_eval.phpt
new file mode 100644
index 0000000000..4bb331c76f
--- /dev/null
+++ b/Zend/tests/output_started_at_eval.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Output start at eval()
+--FILE--
+<?php
+eval('echo "Foo\n";');
+header('Foo: Bar');
+?>
+--EXPECTF--
+Foo
+
+Warning: Cannot modify header information - headers already sent by (output started at %s(2) : eval()'d code:1) in %s on line %d
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/parameter_default_values/internal_declaration_error_class_const.phpt b/Zend/tests/parameter_default_values/internal_declaration_error_class_const.phpt
new file mode 100644
index 0000000000..69e7607bb3
--- /dev/null
+++ b/Zend/tests/parameter_default_values/internal_declaration_error_class_const.phpt
@@ -0,0 +1,13 @@
+--TEST--
+The default value is a class constant in the parent class method's signature.
+--FILE--
+<?php
+class MyDateTimeZone extends DateTimeZone
+{
+ public static function listIdentifiers()
+ {
+ }
+}
+?>
+--EXPECTF--
+Fatal error: Declaration of MyDateTimeZone::listIdentifiers() must be compatible with DateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null) in %s on line %d
diff --git a/Zend/tests/parameter_default_values/internal_declaration_error_const.phpt b/Zend/tests/parameter_default_values/internal_declaration_error_const.phpt
new file mode 100644
index 0000000000..9335abd5d6
--- /dev/null
+++ b/Zend/tests/parameter_default_values/internal_declaration_error_const.phpt
@@ -0,0 +1,13 @@
+--TEST--
+The default value is a constant in the parent class method's signature.
+--FILE--
+<?php
+class MyDateTimeZone extends DateTimeZone
+{
+ public function getTransitions()
+ {
+ }
+}
+?>
+--EXPECTF--
+Fatal error: Declaration of MyDateTimeZone::getTransitions() must be compatible with DateTimeZone::getTransitions(int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX) in %s on line %d
diff --git a/Zend/tests/parameter_default_values/internal_declaration_error_false.phpt b/Zend/tests/parameter_default_values/internal_declaration_error_false.phpt
new file mode 100644
index 0000000000..80c98a4052
--- /dev/null
+++ b/Zend/tests/parameter_default_values/internal_declaration_error_false.phpt
@@ -0,0 +1,12 @@
+--TEST--
+The default value is false in the parent class method's signature.
+--FILE--
+<?php
+
+interface MyDateTimeInterface extends DateTimeInterface
+{
+ public function diff();
+}
+?>
+--EXPECTF--
+Fatal error: Declaration of MyDateTimeInterface::diff() must be compatible with DateTimeInterface::diff(DateTimeInterface $targetObject, bool $absolute = false) in %s on line %d
diff --git a/Zend/tests/parameter_default_values/internal_declaration_error_int.phpt b/Zend/tests/parameter_default_values/internal_declaration_error_int.phpt
new file mode 100644
index 0000000000..c32cc9e41f
--- /dev/null
+++ b/Zend/tests/parameter_default_values/internal_declaration_error_int.phpt
@@ -0,0 +1,13 @@
+--TEST--
+The default value is an integer in the parent class method's signature.
+--FILE--
+<?php
+class MyDateTime extends DateTime
+{
+ public function setTime(int $hour, int $minute, int $second = 0, bool $microsecond = false)
+ {
+ }
+}
+?>
+--EXPECTF--
+Fatal error: Declaration of MyDateTime::setTime(int $hour, int $minute, int $second = 0, bool $microsecond = false) must be compatible with DateTime::setTime(int $hour, int $minute, int $second = 0, int $microsecond = 0) in %s on line %d
diff --git a/Zend/tests/parameter_default_values/internal_declaration_error_null.phpt b/Zend/tests/parameter_default_values/internal_declaration_error_null.phpt
new file mode 100644
index 0000000000..3804c2a6e1
--- /dev/null
+++ b/Zend/tests/parameter_default_values/internal_declaration_error_null.phpt
@@ -0,0 +1,13 @@
+--TEST--
+The default value is null in the parent class method's signature.
+--FILE--
+<?php
+class MyDateTime extends DateTime
+{
+ public static function createFromFormat()
+ {
+ }
+}
+?>
+--EXPECTF--
+Fatal error: Declaration of MyDateTime::createFromFormat() must be compatible with DateTime::createFromFormat(string $format, string $datetime, ?DateTimeZone $timezone = null) in %s on line %d
diff --git a/Zend/tests/parameter_default_values/userland_declaration_error_class_const.phpt b/Zend/tests/parameter_default_values/userland_declaration_error_class_const.phpt
new file mode 100644
index 0000000000..40648c80b2
--- /dev/null
+++ b/Zend/tests/parameter_default_values/userland_declaration_error_class_const.phpt
@@ -0,0 +1,26 @@
+--TEST--
+The default value is a constant in the parent class method's signature.
+--FILE--
+<?php
+
+use Foo\Bar;
+
+class A
+{
+ public function foo(
+ $param1 = \Foo\Bar::CONSTANT,
+ $param2 = Foo\Bar::CONSTANT,
+ $param3 = Bar::CONSTANT
+ ) {
+ }
+}
+
+class B extends A
+{
+ public function foo()
+ {
+ }
+}
+?>
+--EXPECTF--
+Fatal error: Declaration of B::foo() must be compatible with A::foo($param1 = Foo\Bar::CONSTANT, $param2 = Foo\Bar::CONSTANT, $param3 = Foo\Bar::CONSTANT) in %s on line %d
diff --git a/Zend/tests/parameter_default_values/userland_declaration_error_const.phpt b/Zend/tests/parameter_default_values/userland_declaration_error_const.phpt
new file mode 100644
index 0000000000..1ceefbad68
--- /dev/null
+++ b/Zend/tests/parameter_default_values/userland_declaration_error_const.phpt
@@ -0,0 +1,26 @@
+--TEST--
+The default value is a constant in the parent class method's signature.
+--FILE--
+<?php
+
+use const Foo\CONSTANT;
+
+class A
+{
+ public function foo(
+ $param1 = \Foo\CONSTANT,
+ $param2 = Foo\CONSTANT,
+ $param3 = CONSTANT
+ ) {
+ }
+}
+
+class B extends A
+{
+ public function foo()
+ {
+ }
+}
+?>
+--EXPECTF--
+Fatal error: Declaration of B::foo() must be compatible with A::foo($param1 = Foo\CONSTANT, $param2 = Foo\CONSTANT, $param3 = Foo\CONSTANT) in %s on line %d
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/pow_array_leak.phpt b/Zend/tests/pow_array_leak.phpt
index e9165bbbc5..06dce0ac6a 100644
--- a/Zend/tests/pow_array_leak.phpt
+++ b/Zend/tests/pow_array_leak.phpt
@@ -4,14 +4,30 @@ Memory leak on ** with result==op1 array
<?php
$x = [0];
-$x **= 1;
+try {
+ $x **= 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($x);
$x = [0];
-$x **= $x;
+try {
+ $x **= $x;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($x);
?>
--EXPECT--
-int(0)
-int(0)
+Unsupported operand types: array ** int
+array(1) {
+ [0]=>
+ int(0)
+}
+Unsupported operand types: array ** array
+array(1) {
+ [0]=>
+ int(0)
+}
diff --git a/Zend/tests/property_exists.phpt b/Zend/tests/property_exists.phpt
index 144b69c231..19823c45a6 100644
--- a/Zend/tests/property_exists.phpt
+++ b/Zend/tests/property_exists.phpt
@@ -4,33 +4,33 @@ Testing property_exists()
<?php
class aParent {
- public static function staticTest() {
- $a = new A;
- var_dump(property_exists($a, "prot"));
- var_dump(property_exists($a, "prot2"));
- var_dump(property_exists($a, "prot3"));
- print "------------------\n";
- var_dump(property_exists("A", "prot"));
- var_dump(property_exists("A", "prot2"));
- var_dump(property_exists("A", "prot3"));
- print "------------------\n";
- }
- public function nonstaticTest() {
- $a = new A;
- var_dump(property_exists($a, "prot"));
- var_dump(property_exists($a, "prot2"));
- var_dump(property_exists($a, "prot3"));
- print "------------------\n";
- var_dump(property_exists("A", "prot"));
- var_dump(property_exists("A", "prot2"));
- var_dump(property_exists("A", "prot3"));
- }
+ public static function staticTest() {
+ $a = new A;
+ var_dump(property_exists($a, "prot"));
+ var_dump(property_exists($a, "prot2"));
+ var_dump(property_exists($a, "prot3"));
+ print "------------------\n";
+ var_dump(property_exists("A", "prot"));
+ var_dump(property_exists("A", "prot2"));
+ var_dump(property_exists("A", "prot3"));
+ print "------------------\n";
+ }
+ public function nonstaticTest() {
+ $a = new A;
+ var_dump(property_exists($a, "prot"));
+ var_dump(property_exists($a, "prot2"));
+ var_dump(property_exists($a, "prot3"));
+ print "------------------\n";
+ var_dump(property_exists("A", "prot"));
+ var_dump(property_exists("A", "prot2"));
+ var_dump(property_exists("A", "prot3"));
+ }
}
class A extends aParent {
- static public $prot = "prot";
- static protected $prot2 = "prot";
- static private $prot3 = "prot";
+ static public $prot = "prot";
+ static protected $prot2 = "prot";
+ static private $prot3 = "prot";
}
A::staticTest();
diff --git a/Zend/tests/property_guard_hash_val.phpt b/Zend/tests/property_guard_hash_val.phpt
index 9215523064..69f1959a03 100644
--- a/Zend/tests/property_guard_hash_val.phpt
+++ b/Zend/tests/property_guard_hash_val.phpt
@@ -12,5 +12,5 @@ $test = new Test;
var_dump($test->x);
?>
--EXPECTF--
-Notice: Undefined property: Test::$x in %s on line %d
+Warning: Undefined property: Test::$x in %s on line %d
NULL
diff --git a/Zend/tests/real_cast.phpt b/Zend/tests/real_cast.phpt
new file mode 100644
index 0000000000..180ef79230
--- /dev/null
+++ b/Zend/tests/real_cast.phpt
@@ -0,0 +1,10 @@
+--TEST--
+The (real) cast is no longer supported
+--FILE--
+<?php
+
+var_dump((real) 42);
+
+?>
+--EXPECTF--
+Parse error: The (real) cast has been removed, use (float) instead in %s on line %d
diff --git a/Zend/tests/real_cast_deprecation.phpt b/Zend/tests/real_cast_deprecation.phpt
deleted file mode 100644
index a73517c504..0000000000
--- a/Zend/tests/real_cast_deprecation.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-The (real) cast is deprecated
---FILE--
-<?php
-
-var_dump((real) 42);
-
-?>
---EXPECTF--
-Deprecated: The (real) cast is deprecated, use (float) instead in %s on line %d
-float(42)
diff --git a/Zend/tests/recv_init_ref_type.phpt b/Zend/tests/recv_init_ref_type.phpt
new file mode 100644
index 0000000000..29b96d379f
--- /dev/null
+++ b/Zend/tests/recv_init_ref_type.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Check by-ref RECV_INIT with single type
+--FILE--
+<?php
+
+function test(array &$foo = []) {
+}
+
+try {
+ $bar = 42;
+ test($bar);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECTF--
+test(): Argument #1 ($foo) must be of type array, int given, called in %s on line %d
diff --git a/Zend/tests/remove_predecessor_of_pi_node.phpt b/Zend/tests/remove_predecessor_of_pi_node.phpt
index 2346d5aa52..6231f08b3f 100644
--- a/Zend/tests/remove_predecessor_of_pi_node.phpt
+++ b/Zend/tests/remove_predecessor_of_pi_node.phpt
@@ -11,4 +11,4 @@ test();
?>
--EXPECTF--
-Notice: Undefined variable: n in %s on line %d
+Warning: Undefined variable $n in %s on line %d
diff --git a/Zend/tests/require_once_warning_to_exception.phpt b/Zend/tests/require_once_warning_to_exception.phpt
new file mode 100644
index 0000000000..d115ac68cc
--- /dev/null
+++ b/Zend/tests/require_once_warning_to_exception.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Promoting require_once warning to exception
+--FILE--
+<?php
+
+function exception_error_handler($errno, $errstr, $errfile, $errline ) {
+ throw new Exception($errstr);
+}
+set_error_handler("exception_error_handler");
+
+try {
+ $results = require_once 'does-not-exist.php';
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+};
+
+?>
+--EXPECT--
+require_once(does-not-exist.php): Failed to open stream: No such file or directory
diff --git a/Zend/tests/require_parse_exception.phpt b/Zend/tests/require_parse_exception.phpt
index 859589231e..d64efe1786 100644
--- a/Zend/tests/require_parse_exception.phpt
+++ b/Zend/tests/require_parse_exception.phpt
@@ -43,9 +43,9 @@ var_dump("\u{ffffff}");');
?>
--EXPECT--
Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
-syntax error, unexpected end of file on line 2
-syntax error, unexpected end of file on line 3
-syntax error, unexpected end of file, expecting '(' on line 2
+Unclosed '{' on line 2
+Unclosed '{' on line 3
+syntax error, unexpected end of file, expecting "(" on line 2
Invalid numeric literal on line 2
Invalid UTF-8 codepoint escape sequence on line 2
Invalid UTF-8 codepoint escape sequence: Codepoint too large on line 2
diff --git a/Zend/tests/required_param_after_optional.phpt b/Zend/tests/required_param_after_optional.phpt
new file mode 100644
index 0000000000..cd715e77d4
--- /dev/null
+++ b/Zend/tests/required_param_after_optional.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Required parameter after optional is deprecated
+--FILE--
+<?php
+
+function test($testA = null, $testB = null, $testC) {}
+function test2(Type $test2A = null, $test2B = null, $test2C) {}
+function test3(Type $test3A = null, Type2 $test3B = null, $test3C) {}
+
+?>
+--EXPECTF--
+Deprecated: Required parameter $testC follows optional parameter $testA in %s on line %d
+
+Deprecated: Required parameter $test2C follows optional parameter $test2B in %s on line %d
diff --git a/Zend/tests/result_unused.phpt b/Zend/tests/result_unused.phpt
index 12892e8415..d508aaa7ed 100644
--- a/Zend/tests/result_unused.phpt
+++ b/Zend/tests/result_unused.phpt
@@ -14,15 +14,16 @@ $x[0];
$x[3];
class Foo {
- public $prop = array(3);
- function __get($name) {
- return array(4);
- }
+ public $prop = array(3);
+ function __get($name) {
+ return array(4);
+ }
}
$x = new Foo();
$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_ref_none.phpt b/Zend/tests/return_ref_none.phpt
new file mode 100644
index 0000000000..39c41d032b
--- /dev/null
+++ b/Zend/tests/return_ref_none.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Argument-less return from by-ref function
+--FILE--
+<?php
+
+function &test() {
+ return;
+}
+
+$ref =& test();
+
+?>
+--EXPECTF--
+Notice: Only variable references should be returned by reference in %s on line %d
diff --git a/Zend/tests/return_types/001.phpt b/Zend/tests/return_types/001.phpt
index 2b87a562f6..3ebb61213c 100644
--- a/Zend/tests/return_types/001.phpt
+++ b/Zend/tests/return_types/001.phpt
@@ -6,8 +6,9 @@ function test1() : array {
}
test1();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of test1() must be of the type array, none returned in %s:%d
+Fatal error: Uncaught TypeError: test1(): Return value must be of type array, none returned in %s:%d
Stack trace:
#0 %s(%d): test1()
#1 {main}
diff --git a/Zend/tests/return_types/002.phpt b/Zend/tests/return_types/002.phpt
index 615317cf83..b9af03a980 100644
--- a/Zend/tests/return_types/002.phpt
+++ b/Zend/tests/return_types/002.phpt
@@ -7,8 +7,9 @@ function test1() : array {
}
test1();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of test1() must be of the type array, null returned in %s:%d
+Fatal error: Uncaught TypeError: test1(): Return value must be of type array, null returned in %s:%d
Stack trace:
#0 %s(%d): test1()
#1 {main}
diff --git a/Zend/tests/return_types/003.phpt b/Zend/tests/return_types/003.phpt
index ed78d51823..af919b6dab 100644
--- a/Zend/tests/return_types/003.phpt
+++ b/Zend/tests/return_types/003.phpt
@@ -6,8 +6,9 @@ function test1() : array {
return 1;
}
test1();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of test1() must be of the type array, int returned in %s:%d
+Fatal error: Uncaught TypeError: test1(): Return value must be of type array, int returned in %s:%d
Stack trace:
#0 %s(%d): test1()
#1 {main}
diff --git a/Zend/tests/return_types/004.phpt b/Zend/tests/return_types/004.phpt
index 6098d51334..e37ba54110 100644
--- a/Zend/tests/return_types/004.phpt
+++ b/Zend/tests/return_types/004.phpt
@@ -7,8 +7,9 @@ function test1() : array {
}
test1();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of test1() must be of the type array, string returned in %s:%d
+Fatal error: Uncaught TypeError: test1(): Return value must be of type array, string returned in %s:%d
Stack trace:
#0 %s(%d): test1()
#1 {main}
diff --git a/Zend/tests/return_types/005.phpt b/Zend/tests/return_types/005.phpt
index f8d666fae5..9d490df7d9 100644
--- a/Zend/tests/return_types/005.phpt
+++ b/Zend/tests/return_types/005.phpt
@@ -12,8 +12,9 @@ class qux {
$qux = new qux();
$qux->foo();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of qux::foo() must be an instance of foo, instance of qux returned in %s:%d
+Fatal error: Uncaught TypeError: qux::foo(): Return value must be of type foo, qux returned in %s:%d
Stack trace:
#0 %s(%d): qux->foo()
#1 {main}
diff --git a/Zend/tests/return_types/006.phpt b/Zend/tests/return_types/006.phpt
index a4fcea1d25..a5b7803151 100644
--- a/Zend/tests/return_types/006.phpt
+++ b/Zend/tests/return_types/006.phpt
@@ -14,6 +14,7 @@ $comments = new CommentsIterator([new Comment]);
foreach ($comments as $comment) {
var_dump($comment);
}
+?>
--EXPECTF--
object(Comment)#%d (%d) {
}
diff --git a/Zend/tests/return_types/007.phpt b/Zend/tests/return_types/007.phpt
index 21f7023518..4b51e366ec 100644
--- a/Zend/tests/return_types/007.phpt
+++ b/Zend/tests/return_types/007.phpt
@@ -12,6 +12,7 @@ class qux extends foo {
$qux = new qux();
var_dump($qux->foo());
+?>
--EXPECTF--
object(qux)#%d (%d) {
}
diff --git a/Zend/tests/return_types/009.phpt b/Zend/tests/return_types/009.phpt
index 7eda8ce27b..8aadae3b87 100644
--- a/Zend/tests/return_types/009.phpt
+++ b/Zend/tests/return_types/009.phpt
@@ -13,5 +13,6 @@ class qux implements foo {
return $this;
}
}
+?>
--EXPECTF--
Fatal error: Declaration of qux::bar(): biz must be compatible with foo::bar(): foo in %s on line %d
diff --git a/Zend/tests/return_types/010.phpt b/Zend/tests/return_types/010.phpt
index 2cfe97dac2..902fd9ad50 100644
--- a/Zend/tests/return_types/010.phpt
+++ b/Zend/tests/return_types/010.phpt
@@ -8,8 +8,9 @@ function &foo(array &$in) : array {
$array = [1, 2, 3];
var_dump(foo($array));
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of foo() must be of the type array, null returned in %s:%d
+Fatal error: Uncaught TypeError: foo(): Return value must be of type array, null returned in %s:%d
Stack trace:
#0 %s(%d): foo(Array)
#1 {main}
diff --git a/Zend/tests/return_types/011.phpt b/Zend/tests/return_types/011.phpt
index 23dbc1cfdb..76cd6934e8 100644
--- a/Zend/tests/return_types/011.phpt
+++ b/Zend/tests/return_types/011.phpt
@@ -7,6 +7,7 @@ function foo() : callable {
}
var_dump(foo());
+?>
--EXPECTF--
object(Closure)#%d (%d) {
}
diff --git a/Zend/tests/return_types/012.phpt b/Zend/tests/return_types/012.phpt
index b4c02a8ec1..6bddbffe8e 100644
--- a/Zend/tests/return_types/012.phpt
+++ b/Zend/tests/return_types/012.phpt
@@ -13,6 +13,7 @@ class foo {
$baz = new foo();
var_dump($baz->bar());
+?>
--EXPECT--
object(Closure)#2 (2) {
["static"]=>
diff --git a/Zend/tests/return_types/013.phpt b/Zend/tests/return_types/013.phpt
index 5b2c06748d..aa3631a22d 100644
--- a/Zend/tests/return_types/013.phpt
+++ b/Zend/tests/return_types/013.phpt
@@ -13,8 +13,9 @@ class foo {
$baz = new foo();
var_dump($func=$baz->bar(), $func());
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of foo::{closure}() must be of the type array, null returned in %s:%d
+Fatal error: Uncaught TypeError: foo::{closure}(): Return value must be of type array, null returned in %s:%d
Stack trace:
#0 %s(%d): foo->{closure}()
#1 {main}
diff --git a/Zend/tests/return_types/014.phpt b/Zend/tests/return_types/014.phpt
index 655c5a9cc6..7565f59a60 100644
--- a/Zend/tests/return_types/014.phpt
+++ b/Zend/tests/return_types/014.phpt
@@ -4,7 +4,8 @@ Constructors cannot declare a return type
<?php
class Foo {
- function __construct() : Foo {}
+ function __construct() : Foo {}
}
+?>
--EXPECTF--
-Fatal error: Constructor %s::%s() cannot declare a return type in %s on line %d
+Fatal error: Method Foo::__construct() cannot declare a return type in %s on line %d
diff --git a/Zend/tests/return_types/015.phpt b/Zend/tests/return_types/015.phpt
index 973956b6bc..e9557d44c4 100644
--- a/Zend/tests/return_types/015.phpt
+++ b/Zend/tests/return_types/015.phpt
@@ -17,6 +17,7 @@ class Vector implements Collection {
$v = new Vector;
var_dump($v->values());
+?>
--EXPECTF--
object(Collections\Vector)#%d (%d) {
}
diff --git a/Zend/tests/return_types/016.phpt b/Zend/tests/return_types/016.phpt
index cf31d96e6b..e408abbc5e 100644
--- a/Zend/tests/return_types/016.phpt
+++ b/Zend/tests/return_types/016.phpt
@@ -13,6 +13,7 @@ class Foo {
$foo = new Foo;
var_dump($foo->foo(new \EmptyIterator()));
+?>
--EXPECTF--
object(EmptyIterator)#%d (0) {
}
diff --git a/Zend/tests/return_types/017.phpt b/Zend/tests/return_types/017.phpt
index d45cb55d45..e8eff94816 100644
--- a/Zend/tests/return_types/017.phpt
+++ b/Zend/tests/return_types/017.phpt
@@ -17,6 +17,7 @@ class Foo {
$foo = new Foo;
var_dump($foo->foo([]));
+?>
--EXPECTF--
object(EmptyIterator)#%d (%d) {
}
diff --git a/Zend/tests/return_types/018.phpt b/Zend/tests/return_types/018.phpt
index 2512c6cf49..134cdb25a0 100644
--- a/Zend/tests/return_types/018.phpt
+++ b/Zend/tests/return_types/018.phpt
@@ -4,7 +4,8 @@ Destructors cannot declare a return type
<?php
class Foo {
- function __destruct() : Foo {}
+ function __destruct() : Foo {}
}
+?>
--EXPECTF--
-Fatal error: Destructor %s::%s() cannot declare a return type in %s on line %d
+Fatal error: Method Foo::__destruct() cannot declare a return type in %s on line %d
diff --git a/Zend/tests/return_types/019.phpt b/Zend/tests/return_types/019.phpt
index 166b624563..652548c3f9 100644
--- a/Zend/tests/return_types/019.phpt
+++ b/Zend/tests/return_types/019.phpt
@@ -1,10 +1,11 @@
--TEST--
-__clone cannot declare a return type
+__clone can only declare void return
--FILE--
<?php
class Foo {
- function __clone() : Foo {}
+ function __clone() : Foo {}
}
+?>
--EXPECTF--
-Fatal error: %s::%s() cannot declare a return type in %s on line %d
+Fatal error: Foo::__clone(): Return type must be void when declared in %s on line %d
diff --git a/Zend/tests/return_types/020.phpt b/Zend/tests/return_types/020.phpt
index 57c93a8dcd..d97891d4f5 100644
--- a/Zend/tests/return_types/020.phpt
+++ b/Zend/tests/return_types/020.phpt
@@ -7,6 +7,7 @@ function test() : array {
}
test();
+?>
--EXPECTF--
Fatal error: Uncaught Exception in %s:%d
Stack trace:
diff --git a/Zend/tests/return_types/021.phpt b/Zend/tests/return_types/021.phpt
index bd37df68f3..ab241b3367 100644
--- a/Zend/tests/return_types/021.phpt
+++ b/Zend/tests/return_types/021.phpt
@@ -12,6 +12,7 @@ class Bar extends Foo {}
var_dump(Foo::getInstance());
var_dump(Bar::getInstance());
+?>
--EXPECTF--
object(Foo)#%d (%d) {
}
diff --git a/Zend/tests/return_types/022.phpt b/Zend/tests/return_types/022.phpt
index b0686ea8ab..e5468b082a 100644
--- a/Zend/tests/return_types/022.phpt
+++ b/Zend/tests/return_types/022.phpt
@@ -11,5 +11,6 @@ $test = function() use($foo) : Closure {
$callable = $test();
var_dump($callable());
+?>
--EXPECT--
string(3) "bar"
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/024.phpt b/Zend/tests/return_types/024.phpt
index 45c8162335..444a9523b6 100644
--- a/Zend/tests/return_types/024.phpt
+++ b/Zend/tests/return_types/024.phpt
@@ -4,5 +4,6 @@ Return type of self is not allowed in function
<?php
function test(): self {}
+?>
--EXPECTF--
Fatal error: Cannot use "self" when no class scope is active in %s on line 3
diff --git a/Zend/tests/return_types/025.phpt b/Zend/tests/return_types/025.phpt
index c9f0ffef4a..cddacb28e5 100644
--- a/Zend/tests/return_types/025.phpt
+++ b/Zend/tests/return_types/025.phpt
@@ -6,6 +6,7 @@ Return type of self is allowed in closure
$c = function(): self { return $this; };
class Bar { }
var_dump($c->call(new Bar));
+?>
--EXPECT--
object(Bar)#2 (0) {
}
diff --git a/Zend/tests/return_types/026.phpt b/Zend/tests/return_types/026.phpt
index f08c527512..5229379df5 100644
--- a/Zend/tests/return_types/026.phpt
+++ b/Zend/tests/return_types/026.phpt
@@ -4,5 +4,6 @@ Return type of parent is not allowed in function
<?php
function test(): parent {}
+?>
--EXPECTF--
Fatal error: Cannot use "parent" when no class scope is active in %s on line %d
diff --git a/Zend/tests/return_types/027.phpt b/Zend/tests/return_types/027.phpt
index 33a9c7f94d..8357b572ce 100644
--- a/Zend/tests/return_types/027.phpt
+++ b/Zend/tests/return_types/027.phpt
@@ -8,6 +8,7 @@ class B extends A {}
$c = function(parent $x): parent { return $x; };
var_dump($c->bindTo(null, 'B')(new A));
+?>
--EXPECTF--
object(A)#%d (0) {
}
diff --git a/Zend/tests/return_types/028.phpt b/Zend/tests/return_types/028.phpt
index 8ded158a82..802dd7708d 100644
--- a/Zend/tests/return_types/028.phpt
+++ b/Zend/tests/return_types/028.phpt
@@ -4,17 +4,17 @@ Memory leak when returning TMP/VAR with wrong return type
<?php
function foo(): stdClass {
- $a = new stdClass;
- $b = [];
- return [$a, $b];
+ $a = new stdClass;
+ $b = [];
+ return [$a, $b];
}
try {
- foo();
+ foo();
} catch (Error $e) {
- echo $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine();
+ echo $e->getMessage(), " in ", $e->getFile(), " on line ", $e->getLine();
}
?>
--EXPECTF--
-Return value of foo() must be an instance of stdClass, array returned in %s on line %d
+foo(): Return value must be of type stdClass, array returned in %s on line %d
diff --git a/Zend/tests/return_types/029.phpt b/Zend/tests/return_types/029.phpt
index adc07cde7f..c6fb443215 100644
--- a/Zend/tests/return_types/029.phpt
+++ b/Zend/tests/return_types/029.phpt
@@ -1,16 +1,14 @@
--TEST--
return type with finally
---INI--
-opcache.enable=0
--FILE--
<?php
function foo() : array {
- try {
- throw new Exception("xxxx");
- } finally {
- return null;
- }
+ try {
+ throw new Exception("xxxx");
+ } finally {
+ return null;
+ }
}
foo();
@@ -21,7 +19,7 @@ Stack trace:
#0 %s(%d): foo()
#1 {main}
-Next TypeError: Return value of foo() must be of the type array, null returned in %s29.php:%d
+Next TypeError: foo(): Return value must be of type array, null returned in %s:%d
Stack trace:
#0 %s(%d): foo()
#1 {main}
diff --git a/Zend/tests/return_types/030.phpt b/Zend/tests/return_types/030.phpt
index fc41fa6ee6..2f4cb696d5 100644
--- a/Zend/tests/return_types/030.phpt
+++ b/Zend/tests/return_types/030.phpt
@@ -3,7 +3,7 @@ Nullable return value
--FILE--
<?php
function foo($x) : ?array {
- return $x;
+ return $x;
}
foo([]);
@@ -16,7 +16,7 @@ foo(0);
ok
ok
-Fatal error: Uncaught TypeError: Return value of foo() must be of the type array or null, int returned in %s030.php:3
+Fatal error: Uncaught TypeError: foo(): Return value must be of type ?array, int returned in %s:%d
Stack trace:
#0 %s030.php(10): foo(0)
#1 {main}
diff --git a/Zend/tests/return_types/031.phpt b/Zend/tests/return_types/031.phpt
index c41490fd09..2c713853d6 100644
--- a/Zend/tests/return_types/031.phpt
+++ b/Zend/tests/return_types/031.phpt
@@ -3,10 +3,10 @@ Nullable return type inheritance rules (non-nullable and nullable)
--FILE--
<?php
class A {
- function foo(): int {}
+ function foo(): int {}
}
class B extends A {
- function foo(): ?int {}
+ function foo(): ?int {}
}
?>
DONE
diff --git a/Zend/tests/return_types/032.phpt b/Zend/tests/return_types/032.phpt
index 00790b5d60..9d011c0062 100644
--- a/Zend/tests/return_types/032.phpt
+++ b/Zend/tests/return_types/032.phpt
@@ -3,10 +3,10 @@ Nullable return type inheritance rules (nullable and non-nullable)
--FILE--
<?php
class A {
- function foo(): ?int {}
+ function foo(): ?int {}
}
class B extends A {
- function foo(): int {}
+ function foo(): int {}
}
?>
DONE
diff --git a/Zend/tests/return_types/033.phpt b/Zend/tests/return_types/033.phpt
new file mode 100644
index 0000000000..1eb5171cb0
--- /dev/null
+++ b/Zend/tests/return_types/033.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__set can only declare void return
+--FILE--
+<?php
+class Foo {
+ function __set($name, $value) : string {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__set(): Return type must be void when declared in %s on line %d
diff --git a/Zend/tests/return_types/034.phpt b/Zend/tests/return_types/034.phpt
new file mode 100644
index 0000000000..80a57cf1e8
--- /dev/null
+++ b/Zend/tests/return_types/034.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__isset can only declare a boolean return type
+--FILE--
+<?php
+class Foo {
+ function __isset($name) : \stdClass|bool {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__isset(): Return type must be bool when declared in %s on line %d
diff --git a/Zend/tests/return_types/035.phpt b/Zend/tests/return_types/035.phpt
new file mode 100644
index 0000000000..359790b82e
--- /dev/null
+++ b/Zend/tests/return_types/035.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__unset can only declare void return
+--FILE--
+<?php
+class Foo {
+ function __unset($name) : bool {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__unset(): Return type must be void when declared in %s on line %d
diff --git a/Zend/tests/return_types/036.phpt b/Zend/tests/return_types/036.phpt
new file mode 100644
index 0000000000..2f0847f21b
--- /dev/null
+++ b/Zend/tests/return_types/036.phpt
@@ -0,0 +1,11 @@
+--TEST--
+__toString can only declare string return type
+--FILE--
+<?php
+class Foo {
+ public function __toString(): bool {
+ }
+}
+?>
+--EXPECTF--
+Fatal error: Declaration of Foo::__toString(): bool must be compatible with Stringable::__toString(): string in %s on line %d
diff --git a/Zend/tests/return_types/037.phpt b/Zend/tests/return_types/037.phpt
new file mode 100644
index 0000000000..34569e494e
--- /dev/null
+++ b/Zend/tests/return_types/037.phpt
@@ -0,0 +1,11 @@
+--TEST--
+__debugInfo can only declare array as return type
+--FILE--
+<?php
+class Foo {
+ public function __debugInfo(): bool {
+ }
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__debugInfo(): Return type must be ?array when declared in %s on line %d
diff --git a/Zend/tests/return_types/038.phpt b/Zend/tests/return_types/038.phpt
new file mode 100644
index 0000000000..a51658c454
--- /dev/null
+++ b/Zend/tests/return_types/038.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__serialize can only declare array as return type
+--FILE--
+<?php
+class Foo {
+ public function __serialize(): \stdClass {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__serialize(): Return type must be array when declared in %s on line %d
diff --git a/Zend/tests/return_types/039.phpt b/Zend/tests/return_types/039.phpt
new file mode 100644
index 0000000000..15a420757c
--- /dev/null
+++ b/Zend/tests/return_types/039.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__unserialize can only declare void return
+--FILE--
+<?php
+class Foo {
+ public function __unserialize(array $data): array {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__unserialize(): Return type must be void when declared in %s on line %d
diff --git a/Zend/tests/return_types/040.phpt b/Zend/tests/return_types/040.phpt
new file mode 100644
index 0000000000..736a400f44
--- /dev/null
+++ b/Zend/tests/return_types/040.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__sleep can only declare return as array
+--FILE--
+<?php
+class Foo {
+ public function __sleep(): bool|int {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__sleep(): Return type must be array when declared in %s on line %d
diff --git a/Zend/tests/return_types/041.phpt b/Zend/tests/return_types/041.phpt
new file mode 100644
index 0000000000..783e1444bc
--- /dev/null
+++ b/Zend/tests/return_types/041.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__wakeup can only declare return void
+--FILE--
+<?php
+class Foo {
+ public function __wakeup(): bool {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__wakeup(): Return type must be void when declared in %s on line %d
diff --git a/Zend/tests/return_types/042.phpt b/Zend/tests/return_types/042.phpt
new file mode 100644
index 0000000000..069e0228ff
--- /dev/null
+++ b/Zend/tests/return_types/042.phpt
@@ -0,0 +1,24 @@
+--TEST--
+__debugInfo can declare union return type
+--FILE--
+<?php
+class UnionType {
+ public function __debugInfo(): array|null {}
+}
+
+class UnionType2 {
+ public function __debugInfo(): null|array {}
+}
+
+class UnionTypeOldStyle {
+ public function __debugInfo(): ?array {}
+}
+
+class JustAnArray {
+ public function __debugInfo(): array {}
+}
+
+echo 'No problems!';
+?>
+--EXPECT--
+No problems!
diff --git a/Zend/tests/return_types/043.phpt b/Zend/tests/return_types/043.phpt
new file mode 100644
index 0000000000..ecc5660c62
--- /dev/null
+++ b/Zend/tests/return_types/043.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Some magic methods can declare mixed return type
+--FILE--
+<?php
+class Foo {
+ public function __get($name): bool {}
+ public function __call($name, $args): string {}
+ public static function __callStatic($name, $args): self {}
+ public function __invoke(): self {}
+}
+
+class Bar {
+ public function __get($name): string|array {}
+ public function __call($name, $args): int|float {}
+ public static function __callStatic($name, $args): ?object {}
+ public function __invoke(): Foo|int {}
+}
+
+class Baz {
+ public function __get($name): mixed {}
+ public function __call($name, $args): mixed {}
+ public static function __callStatic($name, $args): mixed {}
+ public function __invoke(): mixed {}
+}
+
+echo 'Okay!';
+?>
+--EXPECT--
+Okay!
diff --git a/Zend/tests/return_types/044.phpt b/Zend/tests/return_types/044.phpt
new file mode 100644
index 0000000000..3b708a05a7
--- /dev/null
+++ b/Zend/tests/return_types/044.phpt
@@ -0,0 +1,10 @@
+--TEST--
+__set_state can only declare object as return
+--FILE--
+<?php
+class Foo {
+ public static function __set_state($properties): bool {}
+}
+?>
+--EXPECTF--
+Fatal error: Foo::__set_state(): Return type must be object when declared in %s on line %d
diff --git a/Zend/tests/return_types/bug70557.phpt b/Zend/tests/return_types/bug70557.phpt
index cb4eb498b9..1795a2a26a 100644
--- a/Zend/tests/return_types/bug70557.phpt
+++ b/Zend/tests/return_types/bug70557.phpt
@@ -1,19 +1,17 @@
--TEST--
Bug #70557 (Memleak on return type verifying failed).
---INI--
-opcache.enable=0
--FILE--
<?php
function getNumber() : int {
- return "foo";
+ return "foo";
}
try {
- getNumber();
+ getNumber();
} catch (TypeError $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
--EXPECT--
-string(68) "Return value of getNumber() must be of the type int, string returned"
+string(62) "getNumber(): Return value must be of type int, string returned"
diff --git a/Zend/tests/return_types/bug71092.phpt b/Zend/tests/return_types/bug71092.phpt
index 1d4fe983b3..f8f622e0c4 100644
--- a/Zend/tests/return_types/bug71092.phpt
+++ b/Zend/tests/return_types/bug71092.phpt
@@ -1,22 +1,20 @@
--TEST--
Bug #71092 (Segmentation fault with return type hinting)
---INI--
-opcache.enable=0
--FILE--
<?php
function boom(): array {
- $data = [['id']];
- switch ($data[0]) {
- case ['id']:
- return null;
- }
+ $data = [['id']];
+ switch ($data[0]) {
+ case ['id']:
+ return null;
+ }
}
boom();
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of boom() must be of the type array, null returned in %sbug71092.php:%d
+Fatal error: Uncaught TypeError: boom(): Return value must be of type array, null returned in %s:%d
Stack trace:
#0 %s(%d): boom()
#1 {main}
diff --git a/Zend/tests/return_types/bug71978.phpt b/Zend/tests/return_types/bug71978.phpt
index e3c8440212..b5ba87eaff 100644
--- a/Zend/tests/return_types/bug71978.phpt
+++ b/Zend/tests/return_types/bug71978.phpt
@@ -2,20 +2,12 @@
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 {}
+ function foo(int $a): int {}
}
class B1 extends A1 {
- function foo(string $a): int {}
+ function foo(string $a): int {}
}
?>
--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/return_types/generators001.phpt b/Zend/tests/return_types/generators001.phpt
index 9f89d71102..64793eaa00 100644
--- a/Zend/tests/return_types/generators001.phpt
+++ b/Zend/tests/return_types/generators001.phpt
@@ -14,11 +14,27 @@ function test3() : Traversable {
yield 3;
}
+function test4() : mixed {
+ yield 4;
+}
+
+function test5() : object {
+ yield 5;
+}
+
+function test6() : object|callable {
+ yield 6;
+}
+
var_dump(
test1(),
test2(),
- test3()
+ test3(),
+ test4(),
+ test5(),
+ test6(),
);
+?>
--EXPECTF--
object(Generator)#%d (%d) {
}
@@ -26,3 +42,9 @@ object(Generator)#%d (%d) {
}
object(Generator)#%d (%d) {
}
+object(Generator)#%d (%d) {
+}
+object(Generator)#%d (%d) {
+}
+object(Generator)#%d (%d) {
+}
diff --git a/Zend/tests/return_types/generators002.phpt b/Zend/tests/return_types/generators002.phpt
index 90bada714b..37cc42b3ec 100644
--- a/Zend/tests/return_types/generators002.phpt
+++ b/Zend/tests/return_types/generators002.phpt
@@ -1,9 +1,10 @@
--TEST--
-Generator return type must be Generator, Iterator or Traversable
+Generator return type must be a supertype of Generator
--FILE--
<?php
function test1() : StdClass {
yield 1;
}
+?>
--EXPECTF--
-Fatal error: Generators may only declare a return type of Generator, Iterator, Traversable, or iterable, StdClass is not permitted in %s on line %d
+Fatal error: Generator return type must be a supertype of Generator, StdClass given in %s on line %d
diff --git a/Zend/tests/return_types/generators004.phpt b/Zend/tests/return_types/generators004.phpt
index 4e9aa07f42..d6e9867a7a 100644
--- a/Zend/tests/return_types/generators004.phpt
+++ b/Zend/tests/return_types/generators004.phpt
@@ -11,5 +11,6 @@ $a = function(): \Iterator {
foreach($a() as $value) {
echo $value;
}
+?>
--EXPECT--
1
diff --git a/Zend/tests/return_types/generators005.phpt b/Zend/tests/return_types/generators005.phpt
index a7e3bda042..586e0ec0c8 100644
--- a/Zend/tests/return_types/generators005.phpt
+++ b/Zend/tests/return_types/generators005.phpt
@@ -16,6 +16,7 @@ class SomeCollection implements Collection {
$some = new SomeCollection();
var_dump($some->getIterator());
+?>
--EXPECTF--
object(Generator)#%d (%d) {
}
diff --git a/Zend/tests/return_types/generators006.phpt b/Zend/tests/return_types/generators006.phpt
new file mode 100644
index 0000000000..71ea4d9a83
--- /dev/null
+++ b/Zend/tests/return_types/generators006.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Generator return type must be a supertype of Generator (with union types)
+--FILE--
+<?php
+function test1() : StdClass|ArrayObject|array {
+ yield 1;
+}
+?>
+--EXPECTF--
+Fatal error: Generator return type must be a supertype of Generator, StdClass|ArrayObject|array given in %s on line %d
diff --git a/Zend/tests/return_types/inheritance001.phpt b/Zend/tests/return_types/inheritance001.phpt
index 5e154d0482..5f706efbc9 100644
--- a/Zend/tests/return_types/inheritance001.phpt
+++ b/Zend/tests/return_types/inheritance001.phpt
@@ -10,5 +10,6 @@ class A {
class B extends A {
function foo(): StdClass {}
}
+?>
--EXPECTF--
Fatal error: Declaration of B::foo(): StdClass must be compatible with A::foo(): A in %s on line %d
diff --git a/Zend/tests/return_types/inheritance002.phpt b/Zend/tests/return_types/inheritance002.phpt
index bb00b7e243..1b91af8596 100644
--- a/Zend/tests/return_types/inheritance002.phpt
+++ b/Zend/tests/return_types/inheritance002.phpt
@@ -10,5 +10,6 @@ abstract class A {
class B extends A {
function foo(): StdClass {}
}
+?>
--EXPECTF--
Fatal error: Declaration of B::foo(): StdClass must be compatible with A::foo(): A in %s on line %d
diff --git a/Zend/tests/return_types/inheritance003.phpt b/Zend/tests/return_types/inheritance003.phpt
index e8ebe90cd1..b097dba91a 100644
--- a/Zend/tests/return_types/inheritance003.phpt
+++ b/Zend/tests/return_types/inheritance003.phpt
@@ -10,5 +10,6 @@ interface A {
class B implements A {
function foo(): StdClass {}
}
+?>
--EXPECTF--
Fatal error: Declaration of B::foo(): StdClass must be compatible with A::foo(): A in %s on line %d
diff --git a/Zend/tests/return_types/inheritance004.phpt b/Zend/tests/return_types/inheritance004.phpt
index 1c8d685a63..48d51ccaf5 100644
--- a/Zend/tests/return_types/inheritance004.phpt
+++ b/Zend/tests/return_types/inheritance004.phpt
@@ -16,6 +16,7 @@ class Bar extends Foo {
var_dump(Bar::test());
var_dump(Foo::test());
+?>
--EXPECTF--
object(Bar)#%d (0) {
}
diff --git a/Zend/tests/return_types/inheritance008.phpt b/Zend/tests/return_types/inheritance008.phpt
index df353cda05..08ea45c0c7 100644
--- a/Zend/tests/return_types/inheritance008.phpt
+++ b/Zend/tests/return_types/inheritance008.phpt
@@ -20,6 +20,7 @@ class Bar extends Foo {
var_dump(Bar::test());
var_dump(Foo::test());
+?>
--EXPECTF--
object(B)#%d (0) {
}
diff --git a/Zend/tests/return_types/inheritance009.phpt b/Zend/tests/return_types/inheritance009.phpt
index b7d5628e8d..157ff12ac1 100644
--- a/Zend/tests/return_types/inheritance009.phpt
+++ b/Zend/tests/return_types/inheritance009.phpt
@@ -18,6 +18,7 @@ class Bar extends Foo {
var_dump(Bar::test());
var_dump(Foo::test());
+?>
--EXPECTF--
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
diff --git a/Zend/tests/return_types/internal_functions001.phpt b/Zend/tests/return_types/internal_functions001.phpt
index 7ec5b9c08f..153e32ca6e 100644
--- a/Zend/tests/return_types/internal_functions001.phpt
+++ b/Zend/tests/return_types/internal_functions001.phpt
@@ -6,9 +6,11 @@ if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
// Internal function return types are only checked in debug builds
if (!PHP_DEBUG) die('skip requires debug build');
?>
+--INI--
+opcache.jit=0
--FILE--
<?php
zend_test_array_return();
?>
---EXPECTF--
-Fatal error: Return value of zend_test_array_return() must be of the type array, null returned in %s on line %d
+--EXPECT--
+Fatal error: zend_test_array_return(): Return value must be of type array, null returned in Unknown on line 0
diff --git a/Zend/tests/return_types/return_reference_separation.phpt b/Zend/tests/return_types/return_reference_separation.phpt
index 0151e5ec31..86c206a0d5 100644
--- a/Zend/tests/return_types/return_reference_separation.phpt
+++ b/Zend/tests/return_types/return_reference_separation.phpt
@@ -3,15 +3,15 @@ Return value separation
--FILE--
<?php
function test1(&$abc) : string {
- return $abc;
+ return $abc;
}
function &test2(int $abc) : string {
- return $abc;
+ return $abc;
}
function &test3(int &$abc) : string {
- return $abc;
+ return $abc;
}
$a = 123;
diff --git a/Zend/tests/return_types/rfc001.phpt b/Zend/tests/return_types/rfc001.phpt
index 3fdbf3443c..17a0d59c5f 100644
--- a/Zend/tests/return_types/rfc001.phpt
+++ b/Zend/tests/return_types/rfc001.phpt
@@ -8,8 +8,9 @@ function get_config(): array {
}
get_config();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of get_config() must be of the type array, int returned in %s:%d
+Fatal error: Uncaught TypeError: get_config(): Return value must be of type array, int returned in %s:%d
Stack trace:
#0 %s(%d): get_config()
#1 {main}
diff --git a/Zend/tests/return_types/rfc002.phpt b/Zend/tests/return_types/rfc002.phpt
index a2c326c24a..d2e4aa841f 100644
--- a/Zend/tests/return_types/rfc002.phpt
+++ b/Zend/tests/return_types/rfc002.phpt
@@ -7,5 +7,6 @@ function answer(): int {
}
var_dump(answer());
+?>
--EXPECT--
int(42)
diff --git a/Zend/tests/return_types/rfc003.phpt b/Zend/tests/return_types/rfc003.phpt
index 6b9cc81c69..dc78bf40a7 100644
--- a/Zend/tests/return_types/rfc003.phpt
+++ b/Zend/tests/return_types/rfc003.phpt
@@ -7,8 +7,9 @@ function foo(): DateTime {
}
foo();
+?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Return value of foo() must be an instance of DateTime, null returned in %s:%d
+Fatal error: Uncaught TypeError: foo(): Return value must be of type DateTime, null returned in %s:%d
Stack trace:
#0 %s(%d): foo()
#1 {main}
diff --git a/Zend/tests/return_types/rfc004.phpt b/Zend/tests/return_types/rfc004.phpt
index 189d0553c6..abd12c1e90 100644
--- a/Zend/tests/return_types/rfc004.phpt
+++ b/Zend/tests/return_types/rfc004.phpt
@@ -15,5 +15,6 @@ class UserGateway_MySql implements UserGateway {
return new User;
}
}
+?>
--EXPECTF--
Fatal error: Declaration of UserGateway_MySql::find($id) must be compatible with UserGateway::find($id): User in %s on line 11
diff --git a/Zend/tests/return_types/void_allowed.phpt b/Zend/tests/return_types/void_allowed.phpt
index 8f07c7392e..c887b5264a 100644
--- a/Zend/tests/return_types/void_allowed.phpt
+++ b/Zend/tests/return_types/void_allowed.phpt
@@ -16,5 +16,6 @@ function bar(): void {
bar();
echo "OK!", PHP_EOL;
+?>
--EXPECT--
OK!
diff --git a/Zend/tests/return_types/void_disallowed1.phpt b/Zend/tests/return_types/void_disallowed1.phpt
index 365e2060bf..ff337bbe98 100644
--- a/Zend/tests/return_types/void_disallowed1.phpt
+++ b/Zend/tests/return_types/void_disallowed1.phpt
@@ -8,5 +8,6 @@ function foo(): void {
}
// Note the lack of function call: function validated at compile-time
+?>
--EXPECTF--
Fatal error: A void function must not return a value (did you mean "return;" instead of "return null;"?) in %s on line %d
diff --git a/Zend/tests/return_types/void_disallowed2.phpt b/Zend/tests/return_types/void_disallowed2.phpt
index 7bbc3ac24f..a17a5d9f9a 100644
--- a/Zend/tests/return_types/void_disallowed2.phpt
+++ b/Zend/tests/return_types/void_disallowed2.phpt
@@ -8,5 +8,6 @@ function foo(): void {
}
// Note the lack of function call: function validated at compile-time
+?>
--EXPECTF--
Fatal error: A void function must not return a value in %s on line %d
diff --git a/Zend/tests/return_types/void_parameter.phpt b/Zend/tests/return_types/void_parameter.phpt
index 4c6e918406..b98f4f6cef 100644
--- a/Zend/tests/return_types/void_parameter.phpt
+++ b/Zend/tests/return_types/void_parameter.phpt
@@ -4,5 +4,6 @@ void return type: not valid as a parameter type
<?php
function foobar(void $a) {}
+?>
--EXPECTF--
Fatal error: void cannot be used as a parameter type in %s on line %d
diff --git a/Zend/tests/rope_with_exception.phpt b/Zend/tests/rope_with_exception.phpt
index e73ea64518..1453f0c59c 100644
--- a/Zend/tests/rope_with_exception.phpt
+++ b/Zend/tests/rope_with_exception.phpt
@@ -4,36 +4,36 @@ Exceptions thrown into a rope must not leak
<?php
class Obj {
- function __get($x) {
- throw new Exception();
- }
+ function __get($x) {
+ throw new Exception();
+ }
}
try {
- $x = new Obj;
- $y = 0;
- $r = "$y|$x->x|";
- echo "should never be reached";
+ $x = new Obj;
+ $y = 0;
+ $r = "$y|$x->x|";
+ echo "should never be reached";
} catch (Exception $e) {
- echo "$e\n";
+ echo "$e\n";
}
try {
- $x = new Obj;
- $y = 0;
- $r = "$y$x->x|";
- echo "should never be reached";
+ $x = new Obj;
+ $y = 0;
+ $r = "$y$x->x|";
+ echo "should never be reached";
} catch (Exception $e) {
- echo "$e\n";
+ echo "$e\n";
}
try {
- $x = new Obj;
- $y = 0;
- $r = "$y|$y$x->x";
- echo "should never be reached";
+ $x = new Obj;
+ $y = 0;
+ $r = "$y|$y$x->x";
+ echo "should never be reached";
} catch (Exception $e) {
- echo "$e\n";
+ echo "$e\n";
}
?>
diff --git a/Zend/tests/runtime_compile_time_binary_operands.phpt b/Zend/tests/runtime_compile_time_binary_operands.phpt
index afced7af0c..14195141b1 100644
--- a/Zend/tests/runtime_compile_time_binary_operands.phpt
+++ b/Zend/tests/runtime_compile_time_binary_operands.phpt
@@ -5,121 +5,139 @@ memory_limit=256M
--FILE--
<?php
-$operands = [
- "==",
- "!=",
- "===",
- "!==",
- "<",
- "<=",
- ">",
- ">=",
- "<=>",
- "+",
- "-",
- "*",
- "/",
- "%",
- "**",
- ".",
- "|",
- "&",
- "^",
- "or",
- "and",
- "xor",
- "||",
- "&&",
+$binaryOperators = [
+ "==",
+ "!=",
+ "===",
+ "!==",
+ "<",
+ "<=",
+ ">",
+ ">=",
+ "<=>",
+ "+",
+ "-",
+ "*",
+ "/",
+ "%",
+ "**",
+ ".",
+ "|",
+ "&",
+ "^",
+ "or",
+ "and",
+ "xor",
+ "||",
+ "&&",
+];
+$unaryOperators = [
+ "~",
+ "-",
+ "+",
+ "!",
];
$input = [
- 0,
- 1,
- 2,
- -1,
- 2.0,
- 2.1,
- -2.0,
- -2.1,
- PHP_INT_MAX,
- PHP_INT_MIN,
- PHP_INT_MAX * 2,
- PHP_INT_MIN * 2,
- INF,
- NAN,
- [],
- [1, 2],
- [1, 2, 3],
- [1 => 2, 0 => 1],
- [1, 'a' => 2],
- [1, 4],
- [1, 'a'],
- [1, 2 => 2],
- [1, [ 2 ]],
- null,
- false,
- true,
- "",
- " ",
- "banana",
- "Banana",
- "banan",
- "0",
- "200",
- "20",
- "20a",
- " \t\n\r\v\f20",
- "20 ",
- "2e1",
- "2e150",
- "9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368",
- "-9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368",
- "0.1",
- "-0.1",
- "1e-1",
- "-20",
- "-20.0",
- "0x14",
- (string) PHP_INT_MAX * 2,
- (string) PHP_INT_MIN * 2,
+ 0,
+ 1,
+ 2,
+ -1,
+ 2.0,
+ 2.1,
+ -2.0,
+ -2.1,
+ PHP_INT_MAX,
+ PHP_INT_MIN,
+ PHP_INT_MAX * 2,
+ PHP_INT_MIN * 2,
+ INF,
+ NAN,
+ [],
+ [1, 2],
+ [1, 2, 3],
+ [1 => 2, 0 => 1],
+ [1, 'a' => 2],
+ [1, 4],
+ [1, 'a'],
+ [1, 2 => 2],
+ [1, [ 2 ]],
+ null,
+ false,
+ true,
+ "",
+ " ",
+ "banana",
+ "Banana",
+ "banan",
+ "0",
+ "200",
+ "20",
+ "20a",
+ " \t\n\r\v\f20",
+ "20 ",
+ "2e1",
+ "2e150",
+ "9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368",
+ "-9179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368",
+ "0.1",
+ "-0.1",
+ "1e-1",
+ "-20",
+ "-20.0",
+ "0x14",
+ (string) PHP_INT_MAX * 2,
+ (string) PHP_INT_MIN * 2,
];
function makeParam($param) {
- if ($param === PHP_INT_MIN) {
- return "PHP_INT_MIN";
- }
- if ($param === PHP_INT_MAX) {
- return "PHP_INT_MAX";
- }
- if (is_string($param)) {
- return '"' . strtr($param, ["\t" => '\t', "\n" => '\n', "\r" => '\r', "\v" => '\v', "\f" => '\f', '$' => '\$', '"' => '\"']) . '"';
- }
- return "(" . str_replace("\n", "", var_export($param, true)) . ")";
+ if ($param === PHP_INT_MIN) {
+ return "PHP_INT_MIN";
+ }
+ if ($param === PHP_INT_MAX) {
+ return "PHP_INT_MAX";
+ }
+ if (is_string($param)) {
+ return '"' . strtr($param, ["\t" => '\t', "\n" => '\n', "\r" => '\r', "\v" => '\v', "\f" => '\f', '$' => '\$', '"' => '\"']) . '"';
+ }
+ return "(" . str_replace("\n", "", var_export($param, true)) . ")";
}
$c = 0;
$f = 0;
-function prepareLine($op1, $op2, $cmp, $operator) {
-
- $op1_p = makeParam($op1);
- $op2_p = makeParam($op2);
+function prepareBinaryLine($op1, $op2, $cmp, $operator) {
+ $op1_p = makeParam($op1);
+ $op2_p = makeParam($op2);
- $error = "echo '" . addcslashes("$op1_p $operator $op2_p", "\\'") . '\', "\n"; $f++;';
+ $error = "echo '" . addcslashes("$op1_p $operator $op2_p", "\\'") . '\', "\n"; $f++;';
- $compare = "@($op1_p $operator $op2_p)";
- $line = "\$c++; ";
- try {
- $result = makeParam($cmp());
- $line .= "if (" . ($result === "(NAN)" ? "!is_nan($compare)" : "$compare !== $result") . ") { $error }";
- } catch (Error $e) {
- if (get_class($e) == "Error") {
- return "// exempt $op1_p $operator $op2_p from checking, it generates a compile time error";
- }
- $msg = makeParam($e->getMessage());
- $line .= "try { $compare; $error } catch (Error \$e) { if (\$e->getMessage() !== $msg) { $error } }";
- }
- return $line;
+ $compare = "@($op1_p $operator $op2_p)";
+ $line = "\$c++; ";
+ try {
+ $result = makeParam($cmp());
+ $line .= "if (" . ($result === "(NAN)" ? "!is_nan($compare)" : "$compare !== $result") . ") { $error }";
+ } catch (Error $e) {
+ $msg = makeParam($e->getMessage());
+ $line .= "try { $compare; $error } catch (Error \$e) { if (\$e->getMessage() !== $msg) { $error } }";
+ }
+ return $line;
+}
+function prepareUnaryLine($op, $cmp, $operator) {
+ $op_p = makeParam($op);
+
+ $error = "echo '" . addcslashes("$operator $op_p", "\\'") . '\', "\n"; $f++;';
+
+ $compare = "@($operator $op_p)";
+ $line = "\$c++; ";
+ try {
+ $result = makeParam($cmp());
+ $line .= "if (" . ($result === "(NAN)" ? "!is_nan($compare)" : "$compare !== $result") . ") { $error }";
+ } catch (Error $e) {
+ $msg = makeParam($e->getMessage());
+ $line .= "try { $compare; $error } catch (Error \$e) { if (\$e->getMessage() !== $msg) { $error } }";
+ }
+ return $line;
}
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'compare_binary_operands_temp.php';
@@ -128,14 +146,22 @@ $file = fopen($filename, "w");
fwrite($file, "<?php\n");
foreach ($input as $left) {
- foreach ($input as $right) {
- foreach ($operands as $operand) {
- $line = prepareLine($left, $right, function() use ($left, $right, $operand) {
- return eval("return @(\$left $operand \$right);");
- }, $operand);
- fwrite($file, $line . "\n");
- }
- }
+ foreach ($input as $right) {
+ foreach ($binaryOperators as $operator) {
+ $line = prepareBinaryLine($left, $right, function() use ($left, $right, $operator) {
+ return eval("return @(\$left $operator \$right);");
+ }, $operator);
+ fwrite($file, $line . "\n");
+ }
+ }
+}
+foreach ($input as $right) {
+ foreach ($unaryOperators as $operator) {
+ $line = prepareUnaryLine($right, function() use ($right, $operator) {
+ return eval("return @($operator \$right);");
+ }, $operator);
+ fwrite($file, $line . "\n");
+ }
}
fclose($file);
@@ -143,12 +169,11 @@ fclose($file);
include $filename;
if($c === 0) {
- echo "Completely failed\n";
+ echo "Completely failed\n";
} else {
- echo "Failed: $f\n";
+ echo "Failed: $f\n";
}
?>
-===DONE===
--CLEAN--
<?php
$fl = __DIR__ . DIRECTORY_SEPARATOR . 'compare_binary_operands_temp.php';
@@ -156,4 +181,3 @@ $fl = __DIR__ . DIRECTORY_SEPARATOR . 'compare_binary_operands_temp.php';
?>
--EXPECT--
Failed: 0
-===DONE===
diff --git a/Zend/tests/selfParent_001.phpt b/Zend/tests/selfParent_001.phpt
index e7f1d2defa..e66185fc8f 100644
--- a/Zend/tests/selfParent_001.phpt
+++ b/Zend/tests/selfParent_001.phpt
@@ -3,20 +3,20 @@ Test when constants are initialised. See also selfParent_002.phpt.
--FILE--
<?php
class A {
- const myConst = "const in A";
- const myDynConst = self::myConst;
+ const myConst = "const in A";
+ const myDynConst = self::myConst;
- public static function test() {
- var_dump(self::myDynConst);
- }
+ public static function test() {
+ var_dump(self::myDynConst);
+ }
}
class B extends A {
- const myConst = "const in B";
+ const myConst = "const in B";
- public static function test() {
- var_dump(parent::myDynConst);
- }
+ public static function test() {
+ var_dump(parent::myDynConst);
+ }
}
A::test();
diff --git a/Zend/tests/selfParent_002.phpt b/Zend/tests/selfParent_002.phpt
index fda67f1e88..3b1b62c591 100644
--- a/Zend/tests/selfParent_002.phpt
+++ b/Zend/tests/selfParent_002.phpt
@@ -3,20 +3,20 @@ Test when constants are initialised. See also selfParent_001.phpt.
--FILE--
<?php
class A {
- const myConst = "const in A";
- const myDynConst = self::myConst;
+ const myConst = "const in A";
+ const myDynConst = self::myConst;
- public static function test() {
- var_dump(self::myDynConst);
- }
+ public static function test() {
+ var_dump(self::myDynConst);
+ }
}
class B extends A {
- const myConst = "const in B";
+ const myConst = "const in B";
- public static function test() {
- var_dump(parent::myDynConst);
- }
+ public static function test() {
+ var_dump(parent::myDynConst);
+ }
}
B::test();
diff --git a/Zend/tests/self_and.phpt b/Zend/tests/self_and.phpt
index 26b86e5125..f3662c575c 100644
--- a/Zend/tests/self_and.phpt
+++ b/Zend/tests/self_and.phpt
@@ -12,8 +12,12 @@ $s4 = str_repeat("f", 2);
$s &= 22;
var_dump($s);
-$s1 &= 11;
-var_dump($s1);
+try {
+ $s1 &= 11;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 &= 33;
var_dump($s2);
@@ -28,11 +32,9 @@ echo "Done\n";
?>
--EXPECTF--
int(18)
+Unsupported operand types: string & int
Warning: A non-numeric value encountered in %s on line %d
-int(0)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(33)
string(1) " "
string(2) " "
diff --git a/Zend/tests/self_instanceof_outside_class.phpt b/Zend/tests/self_instanceof_outside_class.phpt
index 4caef37883..ecb593a6a5 100644
--- a/Zend/tests/self_instanceof_outside_class.phpt
+++ b/Zend/tests/self_instanceof_outside_class.phpt
@@ -14,4 +14,4 @@ $fn();
?>
--EXPECT--
-Cannot access self:: when no class scope is active
+Cannot access "self" when no class scope is active
diff --git a/Zend/tests/self_method_or_prop_outside_class.phpt b/Zend/tests/self_method_or_prop_outside_class.phpt
index e4a499def8..feaeccf25f 100644
--- a/Zend/tests/self_method_or_prop_outside_class.phpt
+++ b/Zend/tests/self_method_or_prop_outside_class.phpt
@@ -30,7 +30,7 @@ $fn();
?>
--EXPECT--
-Cannot access self:: when no class scope is active
-Cannot access self:: when no class scope is active
-Cannot access self:: when no class scope is active
-Cannot access self:: when no class scope is active
+Cannot access "self" when no class scope is active
+Cannot access "self" when no class scope is active
+Cannot access "self" when no class scope is active
+Cannot access "self" when no class scope is active
diff --git a/Zend/tests/self_mod.phpt b/Zend/tests/self_mod.phpt
index 0b10987aeb..7d469f8002 100644
--- a/Zend/tests/self_mod.phpt
+++ b/Zend/tests/self_mod.phpt
@@ -10,8 +10,12 @@ $s2 = "45345some";
$s %= 22;
var_dump($s);
-$s1 %= 11;
-var_dump($s1);
+try {
+ $s1 %= 11;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 %= 33;
var_dump($s2);
@@ -20,10 +24,8 @@ echo "Done\n";
?>
--EXPECTF--
int(13)
+Unsupported operand types: string % int
Warning: A non-numeric value encountered in %s on line %d
-int(0)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(3)
Done
diff --git a/Zend/tests/self_or.phpt b/Zend/tests/self_or.phpt
index cecf70d795..61f1f4203b 100644
--- a/Zend/tests/self_or.phpt
+++ b/Zend/tests/self_or.phpt
@@ -12,8 +12,12 @@ $s4 = str_repeat("f", 2);
$s |= 22;
var_dump($s);
-$s1 |= 11;
-var_dump($s1);
+try {
+ $s1 |= 11;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 |= 33;
var_dump($s2);
@@ -28,11 +32,9 @@ echo "Done\n";
?>
--EXPECTF--
int(127)
+Unsupported operand types: string | int
Warning: A non-numeric value encountered in %s on line %d
-int(11)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(45345)
string(1) "f"
string(2) "ff"
diff --git a/Zend/tests/self_xor.phpt b/Zend/tests/self_xor.phpt
index e36a315b10..4bff3f6d50 100644
--- a/Zend/tests/self_xor.phpt
+++ b/Zend/tests/self_xor.phpt
@@ -12,8 +12,12 @@ $s4 = str_repeat("f", 2);
$s ^= 22;
var_dump($s);
-$s1 ^= 11;
-var_dump($s1);
+try {
+ $s1 ^= 11;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 ^= 33;
var_dump($s2);
@@ -28,11 +32,9 @@ echo "Done\n";
?>
--EXPECTF--
int(109)
+Unsupported operand types: string ^ int
Warning: A non-numeric value encountered in %s on line %d
-int(11)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(45312)
string(1) "F"
string(2) "FF"
diff --git a/Zend/tests/settype_array.phpt b/Zend/tests/settype_array.phpt
index 562d349099..57c8e5180c 100644
--- a/Zend/tests/settype_array.phpt
+++ b/Zend/tests/settype_array.phpt
Binary files differ
diff --git a/Zend/tests/settype_bool.phpt b/Zend/tests/settype_bool.phpt
index 06b003ac86..7eabcab5ed 100644
--- a/Zend/tests/settype_bool.phpt
+++ b/Zend/tests/settype_bool.phpt
@@ -6,32 +6,32 @@ casting different variables to boolean using settype()
$r = fopen(__FILE__, "r");
class test {
- function __toString() {
- return "10";
- }
+ function __toString() {
+ return "10";
+ }
}
$o = new test;
$vars = array(
- "string",
- "8754456",
- "",
- "\0",
- 9876545,
- 0.10,
- array(),
- array(1,2,3),
- false,
- true,
- NULL,
- $r,
- $o
+ "string",
+ "8754456",
+ "",
+ "\0",
+ 9876545,
+ 0.10,
+ array(),
+ array(1,2,3),
+ false,
+ true,
+ NULL,
+ $r,
+ $o
);
foreach ($vars as $var) {
- settype($var, "bool");
- var_dump($var);
+ settype($var, "bool");
+ var_dump($var);
}
echo "Done\n";
diff --git a/Zend/tests/settype_double.phpt b/Zend/tests/settype_double.phpt
index 11bdcfee72..6bbe773d0c 100644
--- a/Zend/tests/settype_double.phpt
+++ b/Zend/tests/settype_double.phpt
@@ -8,32 +8,32 @@ precision=14
$r = fopen(__FILE__, "r");
class test {
- function __toString() {
- return "10";
- }
+ function __toString() {
+ return "10";
+ }
}
$o = new test;
$vars = array(
- "string",
- "8754456",
- "",
- "\0",
- 9876545,
- 0.10,
- array(),
- array(1,2,3),
- false,
- true,
- NULL,
- $r,
- $o
+ "string",
+ "8754456",
+ "",
+ "\0",
+ 9876545,
+ 0.10,
+ array(),
+ array(1,2,3),
+ false,
+ true,
+ NULL,
+ $r,
+ $o
);
foreach ($vars as $var) {
- settype($var, "double");
- var_dump($var);
+ settype($var, "double");
+ var_dump($var);
}
echo "Done\n";
@@ -50,8 +50,8 @@ float(1)
float(0)
float(1)
float(0)
-float(%d)
+float(%f)
-Notice: Object of class test could not be converted to float in %s on line %d
+Warning: Object of class test could not be converted to float in %s on line %d
float(1)
Done
diff --git a/Zend/tests/settype_int.phpt b/Zend/tests/settype_int.phpt
index f278bf1bcd..e5eb098a67 100644
--- a/Zend/tests/settype_int.phpt
+++ b/Zend/tests/settype_int.phpt
@@ -6,32 +6,32 @@ casting different variables to integer using settype()
$r = fopen(__FILE__, "r");
class test {
- function __toString() {
- return "10";
- }
+ function __toString() {
+ return "10";
+ }
}
$o = new test;
$vars = array(
- "string",
- "8754456",
- "",
- "\0",
- 9876545,
- 0.10,
- array(),
- array(1,2,3),
- false,
- true,
- NULL,
- $r,
- $o
+ "string",
+ "8754456",
+ "",
+ "\0",
+ 9876545,
+ 0.10,
+ array(),
+ array(1,2,3),
+ false,
+ true,
+ NULL,
+ $r,
+ $o
);
foreach ($vars as $var) {
- settype($var, "int");
- var_dump($var);
+ settype($var, "int");
+ var_dump($var);
}
echo "Done\n";
@@ -50,6 +50,6 @@ int(1)
int(0)
int(%d)
-Notice: Object of class test could not be converted to int in %s on line %d
+Warning: Object of class test could not be converted to int in %s on line %d
int(1)
Done
diff --git a/Zend/tests/settype_null.phpt b/Zend/tests/settype_null.phpt
index e98b71ae8a..04b270ea59 100644
--- a/Zend/tests/settype_null.phpt
+++ b/Zend/tests/settype_null.phpt
@@ -6,32 +6,32 @@ casting different variables to null using settype()
$r = fopen(__FILE__, "r");
class test {
- function __toString() {
- return "10";
- }
+ function __toString() {
+ return "10";
+ }
}
$o = new test;
$vars = array(
- "string",
- "8754456",
- "",
- "\0",
- 9876545,
- 0.10,
- array(),
- array(1,2,3),
- false,
- true,
- NULL,
- $r,
- $o
+ "string",
+ "8754456",
+ "",
+ "\0",
+ 9876545,
+ 0.10,
+ array(),
+ array(1,2,3),
+ false,
+ true,
+ NULL,
+ $r,
+ $o
);
foreach ($vars as $var) {
- settype($var, "null");
- var_dump($var);
+ settype($var, "null");
+ var_dump($var);
}
echo "Done\n";
diff --git a/Zend/tests/settype_object.phpt b/Zend/tests/settype_object.phpt
index be2694c312..9369011127 100644
--- a/Zend/tests/settype_object.phpt
+++ b/Zend/tests/settype_object.phpt
Binary files differ
diff --git a/Zend/tests/settype_resource.phpt b/Zend/tests/settype_resource.phpt
index a6721cb757..884ff3dae3 100644
--- a/Zend/tests/settype_resource.phpt
+++ b/Zend/tests/settype_resource.phpt
Binary files differ
diff --git a/Zend/tests/settype_string.phpt b/Zend/tests/settype_string.phpt
index 3a2d59ecae..cc90fdfdf4 100644
--- a/Zend/tests/settype_string.phpt
+++ b/Zend/tests/settype_string.phpt
Binary files differ
diff --git a/Zend/tests/shift_001.phpt b/Zend/tests/shift_001.phpt
index fba24f5fd0..f441cf2dcf 100644
--- a/Zend/tests/shift_001.phpt
+++ b/Zend/tests/shift_001.phpt
@@ -10,8 +10,12 @@ $s2 = "45345some";
$s <<= 2;
var_dump($s);
-$s1 <<= 1;
-var_dump($s1);
+try {
+ $s1 <<= 1;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 <<= 3;
var_dump($s2);
@@ -20,10 +24,8 @@ echo "Done\n";
?>
--EXPECTF--
int(492)
+Unsupported operand types: string << int
Warning: A non-numeric value encountered in %s on line %d
-int(0)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(362760)
Done
diff --git a/Zend/tests/shift_002.phpt b/Zend/tests/shift_002.phpt
index fa068e1a90..0bdc9b3eeb 100644
--- a/Zend/tests/shift_002.phpt
+++ b/Zend/tests/shift_002.phpt
@@ -10,8 +10,12 @@ $s2 = "45345some";
$s >>= 2;
var_dump($s);
-$s1 >>= 1;
-var_dump($s1);
+try {
+ $s1 >>= 1;
+ var_dump($s1);
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$s2 >>= 3;
var_dump($s2);
@@ -20,10 +24,8 @@ echo "Done\n";
?>
--EXPECTF--
int(30)
+Unsupported operand types: string >> int
Warning: A non-numeric value encountered in %s on line %d
-int(0)
-
-Notice: A non well formed numeric value encountered in %s on line %d
int(5668)
Done
diff --git a/Zend/tests/short_echo_as_identifier.phpt b/Zend/tests/short_echo_as_identifier.phpt
new file mode 100644
index 0000000000..7fc1684861
--- /dev/null
+++ b/Zend/tests/short_echo_as_identifier.phpt
@@ -0,0 +1,15 @@
+--TEST--
+<?= cannot be used as an identifier
+--FILE--
+<?php
+trait T {
+ public function x() {}
+}
+class C {
+ use T {
+ x as y?><?= as my_echo;
+ }
+}
+?>
+--EXPECTF--
+Parse error: Cannot use "<?=" as an identifier in %s on line %d
diff --git a/Zend/tests/special_name_error1.phpt b/Zend/tests/special_name_error1.phpt
deleted file mode 100644
index 63bf5a63fd..0000000000
--- a/Zend/tests/special_name_error1.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Cannot use special class name as namespace
---FILE--
-<?php
-
-namespace self;
-
-?>
---EXPECTF--
-Fatal error: Cannot use 'self' as namespace name in %s on line %d
diff --git a/Zend/tests/static_in_trait_insteadof_list.phpt b/Zend/tests/static_in_trait_insteadof_list.phpt
new file mode 100644
index 0000000000..77ecf1e42b
--- /dev/null
+++ b/Zend/tests/static_in_trait_insteadof_list.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Cannot use static in trait insteadof list
+--FILE--
+<?php
+
+trait SomeTrait {
+ public function foobar() {}
+}
+
+class Test {
+ use SomeTrait {
+ SomeTrait::foobar insteadof static;
+ }
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use 'static' as trait name, as it is reserved in %s on line %d
diff --git a/Zend/tests/static_in_trait_insteadof_reference.phpt b/Zend/tests/static_in_trait_insteadof_reference.phpt
new file mode 100644
index 0000000000..95a6b3c170
--- /dev/null
+++ b/Zend/tests/static_in_trait_insteadof_reference.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Cannot use static in trait insteadof method reference
+--FILE--
+<?php
+
+trait SomeTrait {
+ public function foobar() {}
+}
+
+class Test {
+ use SomeTrait {
+ static::foobar insteadof SomeTrait;
+ }
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use 'static' as trait name, as it is reserved in %s on line %d
diff --git a/Zend/tests/static_method_non_existing_class.phpt b/Zend/tests/static_method_non_existing_class.phpt
index a395c054c5..752655d227 100644
--- a/Zend/tests/static_method_non_existing_class.phpt
+++ b/Zend/tests/static_method_non_existing_class.phpt
@@ -12,4 +12,4 @@ try {
?>
--EXPECT--
-Class 'Test' not found
+Class "Test" not found
diff --git a/Zend/tests/static_variable.phpt b/Zend/tests/static_variable.phpt
index 62ca565ffe..54468de054 100644
--- a/Zend/tests/static_variable.phpt
+++ b/Zend/tests/static_variable.phpt
@@ -5,10 +5,10 @@ Static Variable Expressions
const bar = 2, baz = bar + 1;
function foo() {
- static $a = 1 + 1;
- static $b = [bar => 1 + 1, baz * 2 => 1 << 2];
- static $c = [1 => bar, 3 => baz];
- var_dump($a, $b, $c);
+ static $a = 1 + 1;
+ static $b = [bar => 1 + 1, baz * 2 => 1 << 2];
+ static $c = [1 => bar, 3 => baz];
+ var_dump($a, $b, $c);
}
foo();
diff --git a/Zend/tests/str_offset_001.phpt b/Zend/tests/str_offset_001.phpt
index 3317674857..8cfcf736ee 100644
--- a/Zend/tests/str_offset_001.phpt
+++ b/Zend/tests/str_offset_001.phpt
@@ -5,7 +5,7 @@ string offset 001
// Test positive or null string offsets
function foo($x) {
- var_dump($x);
+ var_dump($x);
}
$str = "abc";
@@ -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..dd6e719303 100644
--- a/Zend/tests/str_offset_003.phpt
+++ b/Zend/tests/str_offset_003.phpt
@@ -5,7 +5,7 @@ string offset 003
// Test negative string offsets
function foo($x) {
- var_dump($x);
+ var_dump($x);
}
$str = "abcdef";
@@ -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/str_offset_004.phpt b/Zend/tests/str_offset_004.phpt
index 435ab235fa..02f00d581e 100644
--- a/Zend/tests/str_offset_004.phpt
+++ b/Zend/tests/str_offset_004.phpt
@@ -41,9 +41,11 @@ string(15) "abCZefghijklmno"
string(15) "abCZefghijPlmno"
string(15) "abCZefghijPQmno"
-Warning: Illegal string offset: -20 in %sstr_offset_004.php on line %d
+Warning: Illegal string offset -20 in %s on line %d
string(15) "abCZefghijPQmno"
string(15) "AbCZefghijPQmno"
string(21) "AbCZefghijPQmno N"
+
+Warning: Only the first byte will be assigned to the string offset in %s on line %d
string(21) "AbCZefghijPQmno UN"
string(21) "AbCZefghijPQmno nUN"
diff --git a/Zend/tests/str_or_obj_of_class_zpp.phpt b/Zend/tests/str_or_obj_of_class_zpp.phpt
new file mode 100644
index 0000000000..b8f5d8492f
--- /dev/null
+++ b/Zend/tests/str_or_obj_of_class_zpp.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test Z_PARAM_OBJ_OF_CLASS_OR_STR() and Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL
+--SKIPIF--
+<?php
+if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
+?>
+--FILE--
+<?php
+
+class Foo {}
+class ToString {
+ public function __toString() {
+ return "ToString";
+ }
+}
+
+var_dump(zend_string_or_stdclass("string"));
+var_dump(zend_string_or_stdclass(1));
+var_dump(zend_string_or_stdclass(null));
+var_dump(zend_string_or_stdclass(new stdClass()));
+var_dump(zend_string_or_stdclass(new ToString()));
+
+try {
+ zend_string_or_stdclass([]);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ zend_string_or_stdclass(new Foo());
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+var_dump(zend_string_or_stdclass_or_null("string"));
+var_dump(zend_string_or_stdclass_or_null(1));
+var_dump(zend_string_or_stdclass_or_null(null));
+var_dump(zend_string_or_stdclass_or_null(new stdClass()));
+var_dump(zend_string_or_stdclass_or_null(new ToString()));
+
+try {
+ zend_string_or_stdclass_or_null([]);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ zend_string_or_stdclass_or_null(new Foo());
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+string(6) "string"
+string(1) "1"
+string(0) ""
+object(stdClass)#1 (0) {
+}
+string(8) "ToString"
+zend_string_or_stdclass(): Argument #1 ($param) must be of type stdClass|string, array given
+zend_string_or_stdclass(): Argument #1 ($param) must be of type stdClass|string, Foo given
+string(6) "string"
+string(1) "1"
+NULL
+object(stdClass)#1 (0) {
+}
+string(8) "ToString"
+zend_string_or_stdclass_or_null(): Argument #1 ($param) must be of type stdClass|string|null, array given
+zend_string_or_stdclass_or_null(): Argument #1 ($param) must be of type stdClass|string|null, Foo given
diff --git a/Zend/tests/str_or_obj_zpp.phpt b/Zend/tests/str_or_obj_zpp.phpt
new file mode 100644
index 0000000000..301abd8ddc
--- /dev/null
+++ b/Zend/tests/str_or_obj_zpp.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test Z_PARAM_OBJ_OR_STR() and Z_PARAM_OBJ_OR_STR_OR_NULL
+--SKIPIF--
+<?php
+if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
+?>
+--FILE--
+<?php
+
+class Foo {}
+
+var_dump(zend_string_or_object("string"));
+var_dump(zend_string_or_object(1));
+var_dump(zend_string_or_object(null));
+var_dump(zend_string_or_object(new stdClass()));
+var_dump(zend_string_or_object(new Foo()));
+
+try {
+ zend_string_or_object([]);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+var_dump(zend_string_or_object_or_null("string"));
+var_dump(zend_string_or_object_or_null(1));
+var_dump(zend_string_or_object_or_null(null));
+var_dump(zend_string_or_object_or_null(new stdClass()));
+var_dump(zend_string_or_object_or_null(new Foo()));
+
+try {
+ zend_string_or_object_or_null([]);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+string(6) "string"
+string(1) "1"
+string(0) ""
+object(stdClass)#1 (0) {
+}
+object(Foo)#1 (0) {
+}
+zend_string_or_object(): Argument #1 ($param) must be of type object|string, array given
+string(6) "string"
+string(1) "1"
+NULL
+object(stdClass)#2 (0) {
+}
+object(Foo)#2 (0) {
+}
+zend_string_or_object_or_null(): Argument #1 ($param) must be of type object|string|null, array given
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/strict_002.phpt b/Zend/tests/strict_002.phpt
index 8f76c8cf01..7f9c613801 100644
--- a/Zend/tests/strict_002.phpt
+++ b/Zend/tests/strict_002.phpt
@@ -6,7 +6,7 @@ error_reporting=8191
<?php
class test {
- static $foo = 1;
+ static $foo = 1;
}
$t = new test;
diff --git a/Zend/tests/string_offset_int_min_max.phpt b/Zend/tests/string_offset_int_min_max.phpt
index b8bd4bcd6b..008a55161c 100644
--- a/Zend/tests/string_offset_int_min_max.phpt
+++ b/Zend/tests/string_offset_int_min_max.phpt
@@ -9,8 +9,8 @@ var_dump($str[PHP_INT_MIN]);
?>
--EXPECTF--
-Notice: Uninitialized string offset: %d in %s on line %d
+Warning: Uninitialized string offset %d in %s on line %d
string(0) ""
-Notice: Uninitialized string offset: -%d in %s on line %d
+Warning: Uninitialized string offset -%d in %s on line %d
string(0) ""
diff --git a/Zend/tests/string_to_number_comparison.phpt b/Zend/tests/string_to_number_comparison.phpt
new file mode 100644
index 0000000000..86ba8a7a8b
--- /dev/null
+++ b/Zend/tests/string_to_number_comparison.phpt
@@ -0,0 +1,92 @@
+--TEST--
+String to number comparison
+--FILE--
+<?php
+
+// This tests the examples from the RFC.
+
+function format($val) {
+ if (is_float($val)) {
+ if (is_nan($val)) return "NAN";
+ if ($val == INF) return "INF";
+ if ($val == -INF) return "-INF";
+ }
+ return json_encode($val);
+}
+
+function compare_eq($val1, $val2) {
+ echo format($val1), " == ", format($val2), ": ", format($val1 == $val2), "\n";
+}
+
+function compare_3way($val1, $val2) {
+ echo format($val1), " <=> ", format($val2), ": ", format($val1 <=> $val2), "\n";
+}
+
+compare_eq(42, "000042");
+compare_eq(42, "42.0");
+compare_eq(42.0, "+42.0E0");
+compare_eq(0, "0e214987142012");
+echo "\n";
+
+compare_eq("42", "000042");
+compare_eq("42", "42.0");
+compare_eq("42.0", "+42.0E0");
+compare_eq("0", "0e214987142012");
+echo "\n";
+
+compare_eq(42, " 42");
+compare_eq(42, "42 ");
+compare_eq(42, "42abc");
+compare_eq(42, "abc42");
+compare_eq( 0, "abc42");
+echo "\n";
+
+compare_eq(INF, "INF");
+compare_eq(-INF, "-INF");
+compare_eq(NAN, "NAN");
+compare_eq(INF, "1e1000");
+compare_eq(-INF, "-1e1000");
+echo "\n";
+
+$float = 1.75;
+
+echo "precision=14:\n";
+ini_set('precision', 14);
+compare_3way($float, "1.75abc");
+compare_3way((string) $float, "1.75abc");
+
+echo "precision=0:\n";
+ini_set('precision', 0);
+compare_3way($float, "1.75abc");
+compare_3way((string) $float, "1.75abc");
+
+?>
+--EXPECT--
+42 == "000042": true
+42 == "42.0": true
+42 == "+42.0E0": true
+0 == "0e214987142012": true
+
+"42" == "000042": true
+"42" == "42.0": true
+"42.0" == "+42.0E0": true
+"0" == "0e214987142012": true
+
+42 == " 42": true
+42 == "42 ": true
+42 == "42abc": false
+42 == "abc42": false
+0 == "abc42": false
+
+INF == "INF": true
+-INF == "-INF": true
+NAN == "NAN": false
+INF == "1e1000": true
+-INF == "-1e1000": true
+
+precision=14:
+1.75 <=> "1.75abc": -1
+"1.75" <=> "1.75abc": -1
+precision=0:
+1.75 <=> "1.75abc": 1
+"2" <=> "1.75abc": 1
diff --git a/Zend/tests/stringable_automatic_implementation.phpt b/Zend/tests/stringable_automatic_implementation.phpt
new file mode 100644
index 0000000000..5c45c03acb
--- /dev/null
+++ b/Zend/tests/stringable_automatic_implementation.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Stringable is automatically implemented
+--FILE--
+<?php
+
+class Test {
+ public function __toString() {
+ return "foo";
+ }
+}
+
+var_dump(new Test instanceof Stringable);
+var_dump((new ReflectionClass(Test::class))->getInterfaceNames());
+
+class Test2 extends Test {
+ public function __toString() {
+ return "bar";
+ }
+}
+
+var_dump(new Test2 instanceof Stringable);
+var_dump((new ReflectionClass(Test2::class))->getInterfaceNames());
+
+?>
+--EXPECT--
+bool(true)
+array(1) {
+ [0]=>
+ string(10) "Stringable"
+}
+bool(true)
+array(1) {
+ [0]=>
+ string(10) "Stringable"
+}
diff --git a/Zend/tests/strlen.phpt b/Zend/tests/strlen.phpt
index ddf0141386..bf55c3419a 100644
--- a/Zend/tests/strlen.phpt
+++ b/Zend/tests/strlen.phpt
@@ -41,6 +41,7 @@ var_dump($a);
$a = 'foobar';
var_dump(strlen($t2));
var_dump($t2->something);
+?>
--EXPECT--
int(5)
string(5) "hello"
diff --git a/Zend/tests/sub_001.phpt b/Zend/tests/sub_001.phpt
index ef02c38241..92e3ff0021 100644
--- a/Zend/tests/sub_001.phpt
+++ b/Zend/tests/sub_001.phpt
@@ -7,9 +7,9 @@ $a = array(1,2,3);
$b = array(1);
try {
- var_dump($a - $b);
+ var_dump($a - $b);
} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$c = $a - $b;
@@ -18,9 +18,9 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
-Exception: Unsupported operand types
+Exception: Unsupported operand types: array - array
-Fatal error: Uncaught Error: Unsupported operand types in %s:%d
+Fatal error: Uncaught TypeError: Unsupported operand types: array - array in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/temporary_cleaning_001.phpt b/Zend/tests/temporary_cleaning_001.phpt
index f2ccbb35b8..9622a4a542 100644
--- a/Zend/tests/temporary_cleaning_001.phpt
+++ b/Zend/tests/temporary_cleaning_001.phpt
@@ -8,12 +8,12 @@ function ops() {
}
try {
- $x = 2;
- $y = new stdClass;
- while ($x-- && new stdClass) {
- $r = [$x] + ($y ? ((array) $x) + [2] : ops());
- $y = (array) $y;
- }
+ $x = 2;
+ $y = new stdClass;
+ while ($x-- && new stdClass) {
+ $r = [$x] + ($y ? ((array) $x) + [2] : ops());
+ $y = (array) $y;
+ }
} catch (Exception $e) {
}
diff --git a/Zend/tests/temporary_cleaning_002.phpt b/Zend/tests/temporary_cleaning_002.phpt
index bea54e7f77..77be1dbd0a 100644
--- a/Zend/tests/temporary_cleaning_002.phpt
+++ b/Zend/tests/temporary_cleaning_002.phpt
@@ -3,26 +3,26 @@ Temporary leak on rope (encapsed string)
--FILE--
<?php
class Obj {
- function __get($x) {
- throw new Exception();
- }
+ function __get($x) {
+ throw new Exception();
+ }
}
$x = new Obj;
$y = 0;
try {
- $r = "$y|$x->x|";
+ $r = "$y|$x->x|";
} catch (Exception $e) {
}
try {
- $r = "$x->x|$y|";
+ $r = "$x->x|$y|";
} catch (Exception $e) {
}
try {
- $r = "$y|$y|$x->x";
+ $r = "$y|$y|$x->x";
} catch (Exception $e) {
}
diff --git a/Zend/tests/temporary_cleaning_004.phpt b/Zend/tests/temporary_cleaning_004.phpt
index b8a02516b0..8e94b25229 100644
--- a/Zend/tests/temporary_cleaning_004.phpt
+++ b/Zend/tests/temporary_cleaning_004.phpt
@@ -9,32 +9,32 @@ function ops() {
$a = [new stdClass, new stdClass];
switch ($a[0]) {
- case false:
- break;
- default:
- try {
- $x = 2;
- $y = new stdClass;
- while ($x-- && new stdClass) {
- $r = [$x] + ($y ? ((array) $x) + [2] : ops());
- $y = (array) $y;
- }
- } catch (Exception $e) {
- }
+ case false:
+ break;
+ default:
+ try {
+ $x = 2;
+ $y = new stdClass;
+ while ($x-- && new stdClass) {
+ $r = [$x] + ($y ? ((array) $x) + [2] : ops());
+ $y = (array) $y;
+ }
+ } catch (Exception $e) {
+ }
}
try {
- switch ($a[0]) {
- case false:
- break;
- default:
- $x = 2;
- $y = new stdClass;
- while ($x-- && new stdClass) {
- $r = [$x] + ($y ? ((array) $x) + [2] : ops());
- $y = (array) $y;
- }
- }
+ switch ($a[0]) {
+ case false:
+ break;
+ default:
+ $x = 2;
+ $y = new stdClass;
+ while ($x-- && new stdClass) {
+ $r = [$x] + ($y ? ((array) $x) + [2] : ops());
+ $y = (array) $y;
+ }
+ }
} catch (Exception $e) {
}
diff --git a/Zend/tests/temporary_cleaning_005.phpt b/Zend/tests/temporary_cleaning_005.phpt
index e8c7febe0b..61bb563a76 100644
--- a/Zend/tests/temporary_cleaning_005.phpt
+++ b/Zend/tests/temporary_cleaning_005.phpt
@@ -9,37 +9,37 @@ function ops() {
$a = [new stdClass, new stdClass];
foreach ([$a, [new stdClass]] as $b) {
- switch ($b[0]) {
- case false:
- break;
- default:
- try {
- $x = 2;
- $y = new stdClass;
- while ($x-- && new stdClass) {
- $r = [$x] + ($y ? ((array) $x) + [2] : ops());
- $y = (array) $y;
- }
- } catch (Exception $e) {
- }
- }
+ switch ($b[0]) {
+ case false:
+ break;
+ default:
+ try {
+ $x = 2;
+ $y = new stdClass;
+ while ($x-- && new stdClass) {
+ $r = [$x] + ($y ? ((array) $x) + [2] : ops());
+ $y = (array) $y;
+ }
+ } catch (Exception $e) {
+ }
+ }
}
foreach ([$a, [new stdClass]] as $b) {
- try {
- switch ($b[0]) {
- case false:
- break;
- default:
- $x = 2;
- $y = new stdClass;
- while ($x-- && new stdClass) {
- $r = [$x] + ($y ? ((array) $x) + [2] : ops());
- $y = (array) $y;
- }
- }
- } catch (Exception $e) {
- }
+ try {
+ switch ($b[0]) {
+ case false:
+ break;
+ default:
+ $x = 2;
+ $y = new stdClass;
+ while ($x-- && new stdClass) {
+ $r = [$x] + ($y ? ((array) $x) + [2] : ops());
+ $y = (array) $y;
+ }
+ }
+ } catch (Exception $e) {
+ }
}
?>
diff --git a/Zend/tests/temporary_cleaning_008.phpt b/Zend/tests/temporary_cleaning_008.phpt
index c876f3c2e8..81a54f351e 100644
--- a/Zend/tests/temporary_cleaning_008.phpt
+++ b/Zend/tests/temporary_cleaning_008.phpt
@@ -3,12 +3,12 @@ Optimization of constant switch expression
--FILE--
<?php
try {
- switch ("1" . (int)2) {
- case 12:
- throw new Exception();
- }
+ switch ("1" . (int)2) {
+ case 12:
+ throw new Exception();
+ }
} catch (Exception $e) {
- echo "exception\n";
+ echo "exception\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/temporary_cleaning_010.phpt b/Zend/tests/temporary_cleaning_010.phpt
index e4456041b2..122a0b28a7 100644
--- a/Zend/tests/temporary_cleaning_010.phpt
+++ b/Zend/tests/temporary_cleaning_010.phpt
@@ -14,7 +14,7 @@ function test() {
try {
test();
} catch (Exception $e) {
- echo "exception\n";
+ echo "exception\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/temporary_cleaning_011.phpt b/Zend/tests/temporary_cleaning_011.phpt
index aa1be00e56..09e2148f72 100644
--- a/Zend/tests/temporary_cleaning_011.phpt
+++ b/Zend/tests/temporary_cleaning_011.phpt
@@ -3,17 +3,17 @@ Live range & lists
--FILE--
<?php
class A {
- function __destruct() {
- throw new Exception();
- }
+ function __destruct() {
+ throw new Exception();
+ }
}
$b = new A();
$x = 0;
$c = [[$x,$x]];
try {
- list($a, $b) = $c[0];
+ list($a, $b) = $c[0];
} catch (Exception $e) {
- echo "exception\n";
+ echo "exception\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/temporary_cleaning_012.phpt b/Zend/tests/temporary_cleaning_012.phpt
index fdbea6d41d..95d2fc1233 100644
--- a/Zend/tests/temporary_cleaning_012.phpt
+++ b/Zend/tests/temporary_cleaning_012.phpt
@@ -17,4 +17,4 @@ try {
?>
--EXPECT--
-Access to undeclared static property: Foo::$property
+Access to undeclared static property Foo::$property
diff --git a/Zend/tests/temporary_cleaning_013.phpt b/Zend/tests/temporary_cleaning_013.phpt
index 34e4080f56..401edb512b 100644
--- a/Zend/tests/temporary_cleaning_013.phpt
+++ b/Zend/tests/temporary_cleaning_013.phpt
@@ -4,271 +4,271 @@ Exceptions thrown in operand cleaning must cause leak of return value
<?php
try {
- var_dump(new class {
- function __toString() { return "a"; }
- function __destruct() { throw new Exception; }
- } . "foo");
+ var_dump(new class {
+ function __toString() { return "a"; }
+ function __destruct() { throw new Exception; }
+ } . "foo");
} catch (Exception $e) { print "caught Exception 1\n"; }
try {
- var_dump([0] + [new class {
- function __destruct() { throw new Exception; }
- }]);
+ var_dump([0] + [new class {
+ function __destruct() { throw new Exception; }
+ }]);
} catch (Exception $e) { print "caught Exception 2\n"; }
try {
- $foo = [0];
- var_dump($foo += [new class {
- function __destruct() { throw new Exception; }
- }]);
+ $foo = [0];
+ var_dump($foo += [new class {
+ function __destruct() { throw new Exception; }
+ }]);
} catch (Exception $e) { print "caught Exception 3\n"; }
try {
- $foo = (object)["foo" => [0]];
- var_dump($foo->foo += [new class {
- function __destruct() { throw new Exception; }
- }]);
+ $foo = (object)["foo" => [0]];
+ var_dump($foo->foo += [new class {
+ function __destruct() { throw new Exception; }
+ }]);
} catch (Exception $e) { print "caught Exception 4\n"; }
try {
- $foo = new class {
- function __get($x) { return [0]; }
- function __set($x, $y) {}
- };
- var_dump($foo->foo += [new class {
- function __destruct() { throw new Exception; }
- }]);
+ $foo = new class {
+ function __get($x) { return [0]; }
+ function __set($x, $y) {}
+ };
+ var_dump($foo->foo += [new class {
+ function __destruct() { throw new Exception; }
+ }]);
} catch (Exception $e) { print "caught Exception 5\n"; }
try {
- $foo = new class {
- public $bar = [0];
- function &__get($x) { return $this->bar; }
- };
- var_dump($foo->foo += [new class {
- function __destruct() { throw new Exception; }
- }]);
+ $foo = new class {
+ public $bar = [0];
+ function &__get($x) { return $this->bar; }
+ };
+ var_dump($foo->foo += [new class {
+ function __destruct() { throw new Exception; }
+ }]);
} catch (Exception $e) { print "caught Exception 6\n"; }
try {
- $foo = new class implements ArrayAccess {
- function offsetGet($x) { return [0]; }
- function offsetSet($x, $y) {}
- function offsetExists($x) { return true; }
- function offsetUnset($x) {}
- };
- var_dump($foo[0] += [new class {
- function __destruct() { throw new Exception; }
- }]);
+ $foo = new class implements ArrayAccess {
+ function offsetGet($x) { return [0]; }
+ function offsetSet($x, $y) {}
+ function offsetExists($x) { return true; }
+ function offsetUnset($x) {}
+ };
+ var_dump($foo[0] += [new class {
+ function __destruct() { throw new Exception; }
+ }]);
} catch (Exception $e) { print "caught Exception 7\n"; }
try {
- $foo = new class implements ArrayAccess {
- public $foo = [0];
- function &offsetGet($x) { return $this->foo; }
- function offsetSet($x, $y) {}
- function offsetExists($x) { return true; }
- function offsetUnset($x) {}
- };
- var_dump($foo[0] += [new class {
- function __destruct() { throw new Exception; }
- }]);
+ $foo = new class implements ArrayAccess {
+ public $foo = [0];
+ function &offsetGet($x) { return $this->foo; }
+ function offsetSet($x, $y) {}
+ function offsetExists($x) { return true; }
+ function offsetUnset($x) {}
+ };
+ var_dump($foo[0] += [new class {
+ function __destruct() { throw new Exception; }
+ }]);
} catch (Exception $e) { print "caught Exception 8\n"; }
try {
- var_dump((function() { return new class {
- function __construct() { $this->foo = new stdClass; }
- function __destruct() { throw new Exception; }
- }; })()->foo++);
+ var_dump((function() { return new class {
+ function __construct() { $this->foo = new stdClass; }
+ function __destruct() { throw new Exception; }
+ }; })()->foo++);
} catch (Exception $e) { print "caught Exception 9\n"; }
try {
- var_dump((function() { return new class {
- function __get($x) { return new stdClass; }
- function __set($x, $y) {}
- function __destruct() { throw new Exception; }
- }; })()->foo++);
+ var_dump((function() { return new class {
+ function __get($x) { return new stdClass; }
+ function __set($x, $y) {}
+ function __destruct() { throw new Exception; }
+ }; })()->foo++);
} catch (Exception $e) { print "caught Exception 10\n"; }
try {
- var_dump((function() { return new class {
- function __construct() { $this->bar = new stdClass; }
- function &__get($x) { return $this->bar; }
- function __destruct() { throw new Exception; }
- }; })()->foo++);
+ var_dump((function() { return new class {
+ function __construct() { $this->bar = new stdClass; }
+ function &__get($x) { return $this->bar; }
+ function __destruct() { throw new Exception; }
+ }; })()->foo++);
} catch (Exception $e) { print "caught Exception 11\n"; }
try {
- var_dump(++(function() { return new class {
- function __construct() { $this->foo = new stdClass; }
- function __destruct() { throw new Exception; }
- }; })()->foo);
+ var_dump(++(function() { return new class {
+ function __construct() { $this->foo = new stdClass; }
+ function __destruct() { throw new Exception; }
+ }; })()->foo);
} catch (Exception $e) { print "caught Exception 12\n"; }
try {
- var_dump(++(function() { return new class {
- function __get($x) { return new stdClass; }
- function __set($x, $y) {}
- function __destruct() { throw new Exception; }
- }; })()->foo);
+ var_dump(++(function() { return new class {
+ function __get($x) { return new stdClass; }
+ function __set($x, $y) {}
+ function __destruct() { throw new Exception; }
+ }; })()->foo);
} catch (Exception $e) { print "caught Exception 13\n"; }
try {
- var_dump(++(function() { return new class {
- function __construct() { $this->bar = new stdClass; }
- function &__get($x) { return $this->bar; }
- function __destruct() { throw new Exception; }
- }; })()->foo);
+ var_dump(++(function() { return new class {
+ function __construct() { $this->bar = new stdClass; }
+ function &__get($x) { return $this->bar; }
+ function __destruct() { throw new Exception; }
+ }; })()->foo);
} catch (Exception $e) { print "caught Exception 14\n"; }
try {
- var_dump((function() { return new class implements ArrayAccess {
- function offsetGet($x) { return [new stdClass]; }
- function offsetSet($x, $y) {}
- function offsetExists($x) { return true; }
- function offsetUnset($x) {}
- function __destruct() { throw new Exception; }
- }; })()[0]++);
+ var_dump((function() { return new class implements ArrayAccess {
+ function offsetGet($x) { return [new stdClass]; }
+ function offsetSet($x, $y) {}
+ function offsetExists($x) { return true; }
+ function offsetUnset($x) {}
+ function __destruct() { throw new Exception; }
+ }; })()[0]++);
} catch (Exception $e) { print "caught Exception 15\n"; }
try {
- var_dump(++(function() { return new class implements ArrayAccess {
- function offsetGet($x) { return [new stdClass]; }
- function offsetSet($x, $y) {}
- function offsetExists($x) { return true; }
- function offsetUnset($x) {}
- function __destruct() { throw new Exception; }
- }; })()[0]);
+ var_dump(++(function() { return new class implements ArrayAccess {
+ function offsetGet($x) { return [new stdClass]; }
+ function offsetSet($x, $y) {}
+ function offsetExists($x) { return true; }
+ function offsetUnset($x) {}
+ function __destruct() { throw new Exception; }
+ }; })()[0]);
} catch (Exception $e) { print "caught Exception 16\n"; }
try {
- var_dump((new class {
- function __construct() { $this->foo = new stdClass; }
- function __destruct() { throw new Exception; }
- })->foo);
+ var_dump((new class {
+ function __construct() { $this->foo = new stdClass; }
+ function __destruct() { throw new Exception; }
+ })->foo);
} catch (Exception $e) { print "caught Exception 17\n"; }
try {
- var_dump((new class {
- function __get($x) { return new stdClass; }
- function __set($x, $y) {}
- function __destruct() { throw new Exception; }
- })->foo);
+ var_dump((new class {
+ function __get($x) { return new stdClass; }
+ function __set($x, $y) {}
+ function __destruct() { throw new Exception; }
+ })->foo);
} catch (Exception $e) { print "caught Exception 18\n"; }
try {
- var_dump((new class implements ArrayAccess {
- function offsetGet($x) { return [new stdClass]; }
- function offsetSet($x, $y) {}
- function offsetExists($x) { return true; }
- function offsetUnset($x) {}
- function __destruct() { throw new Exception; }
- })[0]);
+ var_dump((new class implements ArrayAccess {
+ function offsetGet($x) { return [new stdClass]; }
+ function offsetSet($x, $y) {}
+ function offsetExists($x) { return true; }
+ function offsetUnset($x) {}
+ function __destruct() { throw new Exception; }
+ })[0]);
} catch (Exception $e) { print "caught Exception 19\n"; }
try {
- var_dump(isset((new class {
- function __construct() { $this->foo = new stdClass; }
- function __destruct() { throw new Exception; }
- })->foo->bar));
+ var_dump(isset((new class {
+ function __construct() { $this->foo = new stdClass; }
+ function __destruct() { throw new Exception; }
+ })->foo->bar));
} catch (Exception $e) { print "caught Exception 20\n"; }
try {
- var_dump(isset((new class {
- function __get($x) { return new stdClass; }
- function __set($x, $y) {}
- function __destruct() { throw new Exception; }
- })->foo->bar));
+ var_dump(isset((new class {
+ function __get($x) { return new stdClass; }
+ function __set($x, $y) {}
+ function __destruct() { throw new Exception; }
+ })->foo->bar));
} catch (Exception $e) { print "caught Exception 21\n"; }
try {
- var_dump(isset((new class implements ArrayAccess {
- function offsetGet($x) { return [new stdClass]; }
- function offsetSet($x, $y) {}
- function offsetExists($x) { return true; }
- function offsetUnset($x) {}
- function __destruct() { throw new Exception; }
- })[0]->bar));
+ var_dump(isset((new class implements ArrayAccess {
+ function offsetGet($x) { return [new stdClass]; }
+ function offsetSet($x, $y) {}
+ function offsetExists($x) { return true; }
+ function offsetUnset($x) {}
+ function __destruct() { throw new Exception; }
+ })[0]->bar));
} catch (Exception $e) { print "caught Exception 22\n"; }
try {
- $foo = new class {
- function __destruct() { throw new Exception; }
- };
- var_dump($foo = new stdClass);
+ $foo = new class {
+ function __destruct() { throw new Exception; }
+ };
+ var_dump($foo = new stdClass);
} catch (Exception $e) { print "caught Exception 23\n"; }
try {
- $foo = [new class {
- function __destruct() { throw new Exception; }
- }];
- var_dump($foo[0] = new stdClass);
+ $foo = [new class {
+ function __destruct() { throw new Exception; }
+ }];
+ var_dump($foo[0] = new stdClass);
} catch (Exception $e) { print "caught Exception 24\n"; }
try {
- $foo = (object) ["foo" => new class {
- function __destruct() { throw new Exception; }
- }];
- var_dump($foo->foo = new stdClass);
+ $foo = (object) ["foo" => new class {
+ function __destruct() { throw new Exception; }
+ }];
+ var_dump($foo->foo = new stdClass);
} catch (Exception $e) { print "caught Exception 25\n"; }
try {
- $foo = new class {
- function __get($x) {}
- function __set($x, $y) { throw new Exception; }
- };
- var_dump($foo->foo = new stdClass);
+ $foo = new class {
+ function __get($x) {}
+ function __set($x, $y) { throw new Exception; }
+ };
+ var_dump($foo->foo = new stdClass);
} catch (Exception $e) { print "caught Exception 26\n"; }
try {
- $foo = new class implements ArrayAccess {
- function offsetGet($x) {}
- function offsetSet($x, $y) { throw new Exception; }
- function offsetExists($x) { return true; }
- function offsetUnset($x) {}
- };
- var_dump($foo[0] = new stdClass);
+ $foo = new class implements ArrayAccess {
+ function offsetGet($x) {}
+ function offsetSet($x, $y) { throw new Exception; }
+ function offsetExists($x) { return true; }
+ function offsetUnset($x) {}
+ };
+ var_dump($foo[0] = new stdClass);
} catch (Exception $e) { print "caught Exception 27\n"; }
try {
- $foo = new class {
- function __destruct() { throw new Exception; }
- };
- $bar = new stdClass;
- var_dump($foo = &$bar);
+ $foo = new class {
+ function __destruct() { throw new Exception; }
+ };
+ $bar = new stdClass;
+ var_dump($foo = &$bar);
} catch (Exception $e) { print "caught Exception 28\n"; }
try {
- $f = function() {
- return new class {
- function __toString() { return "a"; }
- function __destruct() { throw new Exception; }
- };
- };
- var_dump("{$f()}foo");
+ $f = function() {
+ return new class {
+ function __toString() { return "a"; }
+ function __destruct() { throw new Exception; }
+ };
+ };
+ var_dump("{$f()}foo");
} catch (Exception $e) { print "caught Exception 29\n"; }
try {
- $f = function() {
- return new class {
- function __toString() { return "a"; }
- function __destruct() { throw new Exception; }
- };
- };
- var_dump("bar{$f()}foo");
+ $f = function() {
+ return new class {
+ function __toString() { return "a"; }
+ function __destruct() { throw new Exception; }
+ };
+ };
+ var_dump("bar{$f()}foo");
} catch (Exception $e) { print "caught Exception 30\n"; }
try {
- var_dump((string) new class {
- function __toString() { $x = "Z"; return ++$x; }
- function __destruct() { throw new Exception; }
- });
+ var_dump((string) new class {
+ function __toString() { $x = "Z"; return ++$x; }
+ function __destruct() { throw new Exception; }
+ });
} catch (Exception $e) { print "caught Exception 31\n"; }
try {
- var_dump(clone (new class {
- function __clone() { throw new Exception; }
- }));
+ var_dump(clone (new class {
+ function __clone() { throw new Exception; }
+ }));
} catch (Exception $e) { print "caught Exception 32\n"; }
?>
@@ -288,10 +288,10 @@ caught Exception 12
caught Exception 13
caught Exception 14
-Notice: Indirect modification of overloaded element of class@anonymous has no effect in %s on line %d
+Notice: Indirect modification of overloaded element of ArrayAccess@anonymous has no effect in %s on line %d
caught Exception 15
-Notice: Indirect modification of overloaded element of class@anonymous has no effect in %s on line %d
+Notice: Indirect modification of overloaded element of ArrayAccess@anonymous has no effect in %s on line %d
caught Exception 16
caught Exception 17
caught Exception 18
diff --git a/Zend/tests/temporary_cleaning_014.phpt b/Zend/tests/temporary_cleaning_014.phpt
index 39effae18a..4ced112094 100644
--- a/Zend/tests/temporary_cleaning_014.phpt
+++ b/Zend/tests/temporary_cleaning_014.phpt
@@ -6,7 +6,7 @@ Leak in JMP_SET
<?php
set_error_handler(function() { throw new Exception; });
try {
- new GMP ?: null;
+ new GMP ?: null;
} catch (Exception $e) {
}
?>
diff --git a/Zend/tests/temporary_cleaning_015.phpt b/Zend/tests/temporary_cleaning_015.phpt
index 7690abba76..f5e115faa9 100644
--- a/Zend/tests/temporary_cleaning_015.phpt
+++ b/Zend/tests/temporary_cleaning_015.phpt
@@ -3,12 +3,12 @@ Attempt to free invalid structure (result of ROPE_INIT is not a zval)
--FILE--
<?php
set_error_handler(function () {
- throw new Exception();
+ throw new Exception();
});
$a = [];
$b = "";
try {
- echo "$a$b\n";
+ echo "$a$b\n";
} catch (Exception $ex) {
}
?>
diff --git a/Zend/tests/ternary_associativity.phpt b/Zend/tests/ternary_associativity.phpt
index 32326513ca..edc0499143 100644
--- a/Zend/tests/ternary_associativity.phpt
+++ b/Zend/tests/ternary_associativity.phpt
@@ -1,30 +1,22 @@
--TEST--
-Using ternary associativity is deprecated
+Allowed nested ternary cases
--FILE--
<?php
-1 ? 2 : 3 ? 4 : 5; // deprecated
(1 ? 2 : 3) ? 4 : 5; // ok
1 ? 2 : (3 ? 4 : 5); // ok
-// While the associativity of ?: is also incorrect, it will not cause a
-// functional difference, only some unnecessary checks.
1 ?: 2 ?: 3; // ok
(1 ?: 2) ?: 3; // ok
1 ?: (2 ?: 3); // ok
-1 ?: 2 ? 3 : 4; // deprecated
(1 ?: 2) ? 3 : 4; // ok
1 ?: (2 ? 3 : 4); // ok
-1 ? 2 : 3 ?: 4; // deprecated
(1 ? 2 : 3) ?: 4; // ok
1 ? 2 : (3 ?: 4); // ok
?>
---EXPECTF--
-Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in %s on line 3
-
-Deprecated: Unparenthesized `a ?: b ? c : d` is deprecated. Use either `(a ?: b) ? c : d` or `a ?: (b ? c : d)` in %s on line 13
-
-Deprecated: Unparenthesized `a ? b : c ?: d` is deprecated. Use either `(a ? b : c) ?: d` or `a ? b : (c ?: d)` in %s on line 17
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/ternary_associativity_1.phpt b/Zend/tests/ternary_associativity_1.phpt
new file mode 100644
index 0000000000..87dc3972d2
--- /dev/null
+++ b/Zend/tests/ternary_associativity_1.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Forbidden nested ternary, case 1
+--FILE--
+<?php
+
+1 ? 2 : 3 ? 4 : 5;
+
+?>
+--EXPECTF--
+Fatal error: Unparenthesized `a ? b : c ? d : e` is not supported. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in %s on line %d
diff --git a/Zend/tests/ternary_associativity_2.phpt b/Zend/tests/ternary_associativity_2.phpt
new file mode 100644
index 0000000000..c311e7cab4
--- /dev/null
+++ b/Zend/tests/ternary_associativity_2.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Forbidden nested ternary, case 2
+--FILE--
+<?php
+
+1 ?: 2 ? 3 : 4;
+
+?>
+--EXPECTF--
+Fatal error: Unparenthesized `a ?: b ? c : d` is not supported. Use either `(a ?: b) ? c : d` or `a ?: (b ? c : d)` in %s on line %d
diff --git a/Zend/tests/ternary_associativity_3.phpt b/Zend/tests/ternary_associativity_3.phpt
new file mode 100644
index 0000000000..c519e1fc0f
--- /dev/null
+++ b/Zend/tests/ternary_associativity_3.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Forbidden nested ternary, case 3
+--FILE--
+<?php
+
+1 ? 2 : 3 ?: 4;
+
+?>
+--EXPECTF--
+Fatal error: Unparenthesized `a ? b : c ?: d` is not supported. Use either `(a ? b : c) ?: d` or `a ? b : (c ?: d)` in %s on line %d
diff --git a/Zend/tests/this_as_global.phpt b/Zend/tests/this_as_global.phpt
index 0ba9ade1b9..7901dad7d7 100644
--- a/Zend/tests/this_as_global.phpt
+++ b/Zend/tests/this_as_global.phpt
@@ -3,8 +3,8 @@ $this as global variable
--FILE--
<?php
function foo() {
- global $this;
- var_dump($this);
+ global $this;
+ var_dump($this);
}
foo();
?>
diff --git a/Zend/tests/this_as_parameter.phpt b/Zend/tests/this_as_parameter.phpt
index 93101969a7..a2f13f07e8 100644
--- a/Zend/tests/this_as_parameter.phpt
+++ b/Zend/tests/this_as_parameter.phpt
@@ -3,7 +3,7 @@ $this as parameter
--FILE--
<?php
function foo($this) {
- var_dump($this);
+ var_dump($this);
}
foo(5);
?>
diff --git a/Zend/tests/this_as_static.phpt b/Zend/tests/this_as_static.phpt
index f094449c12..d990ab5ba1 100644
--- a/Zend/tests/this_as_static.phpt
+++ b/Zend/tests/this_as_static.phpt
@@ -3,8 +3,8 @@ $this as static variable
--FILE--
<?php
function foo() {
- static $this;
- var_dump($this);
+ static $this;
+ var_dump($this);
}
foo();
?>
diff --git a/Zend/tests/this_in_catch.phpt b/Zend/tests/this_in_catch.phpt
index d621bb18ea..d167e047a0 100644
--- a/Zend/tests/this_in_catch.phpt
+++ b/Zend/tests/this_in_catch.phpt
@@ -3,13 +3,13 @@ $this in catch
--FILE--
<?php
class C {
- function foo() {
- try {
- throw new Exception();
- } catch (Exception $this) {
- }
- var_dump($this);
- }
+ function foo() {
+ try {
+ throw new Exception();
+ } catch (Exception $this) {
+ }
+ var_dump($this);
+ }
}
$obj = new C;
$obj->foo();
diff --git a/Zend/tests/this_in_eval.phpt b/Zend/tests/this_in_eval.phpt
index 8da70b76a3..d4bd9268d9 100644
--- a/Zend/tests/this_in_eval.phpt
+++ b/Zend/tests/this_in_eval.phpt
@@ -3,13 +3,14 @@ $this in eval() block
--FILE--
<?php
class C {
- function foo() {
- eval('var_dump($this);');
- eval('var_dump($this);');
- }
+ function foo() {
+ eval('var_dump($this);');
+ eval('var_dump($this);');
+ }
}
$x = new C;
$x->foo();
+?>
--EXPECT--
object(C)#1 (0) {
}
diff --git a/Zend/tests/this_in_extract.phpt b/Zend/tests/this_in_extract.phpt
index 9903d7d794..2e3f7b497f 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_foreach_001.phpt b/Zend/tests/this_in_foreach_001.phpt
index a724338b90..b8a1c07004 100644
--- a/Zend/tests/this_in_foreach_001.phpt
+++ b/Zend/tests/this_in_foreach_001.phpt
@@ -4,7 +4,7 @@ $this in foreach
<?php
$a = [1];
foreach ($a as $this) {
- var_dump($this);
+ var_dump($this);
}
?>
--EXPECTF--
diff --git a/Zend/tests/this_in_foreach_002.phpt b/Zend/tests/this_in_foreach_002.phpt
index 511ea36a24..3b287d675f 100644
--- a/Zend/tests/this_in_foreach_002.phpt
+++ b/Zend/tests/this_in_foreach_002.phpt
@@ -4,7 +4,7 @@ $this in foreach
<?php
$a = [1];
foreach ($a as $this => $dummy) {
- var_dump($this);
+ var_dump($this);
}
?>
--EXPECTF--
diff --git a/Zend/tests/this_in_foreach_003.phpt b/Zend/tests/this_in_foreach_003.phpt
index 5f5b5ae0d8..f815ed6f88 100644
--- a/Zend/tests/this_in_foreach_003.phpt
+++ b/Zend/tests/this_in_foreach_003.phpt
@@ -4,7 +4,7 @@ $this in foreach
<?php
$a = [1];
foreach ($a as &$this) {
- var_dump($this);
+ var_dump($this);
}
?>
--EXPECTF--
diff --git a/Zend/tests/this_in_foreach_004.phpt b/Zend/tests/this_in_foreach_004.phpt
index 13bfbf18b4..33a8b87f1a 100644
--- a/Zend/tests/this_in_foreach_004.phpt
+++ b/Zend/tests/this_in_foreach_004.phpt
@@ -4,7 +4,7 @@ $this in foreach
<?php
$a = [[1]];
foreach ($a as list($this)) {
- var_dump($this);
+ var_dump($this);
}
?>
--EXPECTF--
diff --git a/Zend/tests/this_in_isset.phpt b/Zend/tests/this_in_isset.phpt
index 2ae335df93..6f3b8310e2 100644
--- a/Zend/tests/this_in_isset.phpt
+++ b/Zend/tests/this_in_isset.phpt
@@ -4,29 +4,29 @@ $this in isset
<?php
var_dump(isset($this));
try {
- var_dump(isset($this->foo));
+ var_dump(isset($this->foo));
} catch (Throwable $e) {
- echo "exception\n";
+ echo "exception\n";
}
try {
- var_dump(isset($this->foo->bar));
+ var_dump(isset($this->foo->bar));
} catch (Throwable $e) {
- echo "exception\n";
+ echo "exception\n";
}
try {
- var_dump(isset($this[0]));
+ var_dump(isset($this[0]));
} catch (Throwable $e) {
- echo "exception\n";
+ echo "exception\n";
}
class A extends ArrayObject {
- public $foo = 5;
- function foo() {
- $this[0] = 5;
- var_dump(isset($this));
- var_dump(isset($this->foo));
- var_dump(isset($this[0]));
- }
+ public $foo = 5;
+ function foo() {
+ $this[0] = 5;
+ var_dump(isset($this));
+ var_dump(isset($this->foo));
+ var_dump(isset($this[0]));
+ }
}
$a = new A();
$a->foo();
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/this_reassign.phpt b/Zend/tests/this_reassign.phpt
index d965ef4701..5a9109fd8c 100644
--- a/Zend/tests/this_reassign.phpt
+++ b/Zend/tests/this_reassign.phpt
@@ -3,9 +3,9 @@ $this re-assign
--FILE--
<?php
function foo() {
- $a = "this";
- $$a = 0;
- var_dump($$a);
+ $a = "this";
+ $$a = 0;
+ var_dump($$a);
}
foo();
?>
diff --git a/Zend/tests/throw/001.phpt b/Zend/tests/throw/001.phpt
new file mode 100644
index 0000000000..ba2406c6d3
--- /dev/null
+++ b/Zend/tests/throw/001.phpt
@@ -0,0 +1,173 @@
+--TEST--
+throw expression
+--FILE--
+<?php
+
+try {
+ $result = true && throw new Exception("true && throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = false && throw new Exception("false && throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = true and throw new Exception("true and throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = false and throw new Exception("false and throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = true || throw new Exception("true || throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = false || throw new Exception("false || throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = true or throw new Exception("true or throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = false or throw new Exception("false or throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = null ?? throw new Exception("null ?? throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = "foo" ?? throw new Exception('"foo" ?? throw');
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = null ?: throw new Exception("null ?: throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = "foo" ?: throw new Exception('"foo" ?: throw');
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $callable = fn() => throw new Exception("fn() => throw");
+ var_dump("not yet");
+ $callable();
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+$result = "bar";
+try {
+ $result = throw new Exception();
+} catch (Exception $e) {}
+var_dump($result);
+
+try {
+ var_dump(
+ throw new Exception("exception 1"),
+ throw new Exception("exception 2")
+ );
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = true ? true : throw new Exception("true ? true : throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ $result = false ? true : throw new Exception("false ? true : throw");
+ var_dump($result);
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ throw new Exception() + 1;
+} catch (Throwable $e) {
+ var_dump($e->getMessage());
+}
+
+try {
+ throw $exception = new Exception('throw $exception = new Exception();');
+} catch (Exception $e) {}
+var_dump($exception->getMessage());
+
+try {
+ $exception = null;
+ throw $exception ??= new Exception('throw $exception ??= new Exception();');
+} catch (Exception $e) {}
+var_dump($exception->getMessage());
+
+try {
+ throw null ?? new Exception('throw null ?? new Exception();');
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECT--
+string(13) "true && throw"
+bool(false)
+string(14) "true and throw"
+bool(false)
+bool(true)
+string(14) "false || throw"
+bool(true)
+string(14) "false or throw"
+string(13) "null ?? throw"
+string(3) "foo"
+string(13) "null ?: throw"
+string(3) "foo"
+string(7) "not yet"
+string(13) "fn() => throw"
+string(3) "bar"
+string(11) "exception 1"
+bool(true)
+string(20) "false ? true : throw"
+string(42) "Unsupported operand types: Exception + int"
+string(35) "throw $exception = new Exception();"
+string(37) "throw $exception ??= new Exception();"
+string(30) "throw null ?? new Exception();"
diff --git a/Zend/tests/throw/002.phpt b/Zend/tests/throw/002.phpt
new file mode 100644
index 0000000000..e80dfbb7d1
--- /dev/null
+++ b/Zend/tests/throw/002.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test throw with various expressions
+--FILE--
+<?php
+
+class Foo {
+ public function createNotFoundException() {
+ return new Exception('Not found');
+ }
+
+ public function throwException() {
+ throw $this->createNotFoundException();
+ }
+
+ public static function staticCreateNotFoundException() {
+ return new Exception('Static not found');
+ }
+
+ public static function staticThrowException() {
+ throw static::staticCreateNotFoundException();
+ }
+}
+
+try {
+ (new Foo())->throwException();
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ Foo::staticThrowException();
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ throw true ? new Exception('Ternary true 1') : new Exception('Ternary true 2');
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ throw false ? new Exception('Ternary false 1') : new Exception('Ternary false 2');
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $exception1 = new Exception('Coalesce non-null 1');
+ $exception2 = new Exception('Coalesce non-null 2');
+ throw $exception1 ?? $exception2;
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $exception1 = null;
+ $exception2 = new Exception('Coalesce null 2');
+ throw $exception1 ?? $exception2;
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ throw $exception = new Exception('Assignment');
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $exception = null;
+ throw $exception ??= new Exception('Coalesce assignment null');
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $exception = new Exception('Coalesce assignment non-null 1');
+ throw $exception ??= new Exception('Coalesce assignment non-null 2');
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+$andConditionalTest = function ($condition1, $condition2) {
+ throw $condition1 && $condition2
+ ? new Exception('And in conditional 1')
+ : new Exception('And in conditional 2');
+};
+
+try {
+ $andConditionalTest(false, false);
+} catch(Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $andConditionalTest(false, true);
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $andConditionalTest(true, false);
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ $andConditionalTest(true, true);
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+Not found
+Static not found
+Ternary true 1
+Ternary false 2
+Coalesce non-null 1
+Coalesce null 2
+Assignment
+Coalesce assignment null
+Coalesce assignment non-null 1
+And in conditional 2
+And in conditional 2
+And in conditional 2
+And in conditional 1
diff --git a/Zend/tests/throw/leaks.phpt b/Zend/tests/throw/leaks.phpt
new file mode 100644
index 0000000000..072f65f2fc
--- /dev/null
+++ b/Zend/tests/throw/leaks.phpt
@@ -0,0 +1,31 @@
+--TEST--
+throw expression should not leak temporaries
+--FILE--
+<?php
+
+try {
+ new stdClass(throw new Exception);
+} catch (Exception $e) {
+ echo "Caught\n";
+}
+
+try {
+ $a = [];
+ ($a + [1]) + throw new Exception;
+} catch (Exception $e) {
+ echo "Caught\n";
+}
+
+try {
+ @throw new Exception;
+} catch (Exception $e) {
+ echo "Caught\n";
+}
+var_dump(error_reporting());
+
+?>
+--EXPECT--
+Caught
+Caught
+Caught
+int(32767)
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/trait_type_errors.phpt b/Zend/tests/trait_type_errors.phpt
new file mode 100644
index 0000000000..d3c7c0582f
--- /dev/null
+++ b/Zend/tests/trait_type_errors.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Type errors for methods from traits should refer to using class
+--FILE--
+<?php
+
+trait T {
+ public function test1($arg): int {
+ return $arg;
+ }
+ public function test2(int $arg) {
+ }
+ public function test3(int $arg = 42) {
+ }
+}
+
+class C {
+ use T;
+}
+class P extends C {
+}
+
+$c = new C;
+try {
+ $c->test1("foo");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $c->test2("foo");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $c->test3("foo");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECTF--
+C::test1(): Return value must be of type int, string returned
+C::test2(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d
+C::test3(): Argument #1 ($arg) must be of type int, string given, called in %s on line %d
diff --git a/Zend/tests/traits/abstract_method_1.phpt b/Zend/tests/traits/abstract_method_1.phpt
new file mode 100644
index 0000000000..7ec5316b8a
--- /dev/null
+++ b/Zend/tests/traits/abstract_method_1.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Abstract method from trait enforced in class
+--FILE--
+<?php
+
+trait T {
+ abstract public function neededByTheTrait(int $a, string $b);
+}
+
+class C {
+ use T;
+
+ public function neededByTheTrait(array $a, object $b) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of C::neededByTheTrait(array $a, object $b) must be compatible with T::neededByTheTrait(int $a, string $b) in %s on line %d
diff --git a/Zend/tests/traits/abstract_method_10.phpt b/Zend/tests/traits/abstract_method_10.phpt
new file mode 100644
index 0000000000..3dcd603d41
--- /dev/null
+++ b/Zend/tests/traits/abstract_method_10.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Abstract method in trait using "self" (invalid)
+--FILE--
+<?php
+
+trait T {
+ abstract private function method(self $x): self;
+}
+
+class C {
+ use T;
+
+ private function method(int $x): int { }
+}
+
+?>
+===DONE===
+--EXPECTF--
+Fatal error: Declaration of C::method(int $x): int must be compatible with T::method(C $x): C in %s on line %d
diff --git a/Zend/tests/traits/abstract_method_2.phpt b/Zend/tests/traits/abstract_method_2.phpt
new file mode 100644
index 0000000000..3633f9f4e1
--- /dev/null
+++ b/Zend/tests/traits/abstract_method_2.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Mutually incompatible methods from traits are fine as long as the final method is compatible
+--FILE--
+<?php
+
+trait T1 {
+ abstract public function test();
+}
+trait T2 {
+ abstract public function test(): int;
+}
+
+class C {
+ use T1, T2;
+
+ public function test(): int {}
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/traits/abstract_method_3.phpt b/Zend/tests/traits/abstract_method_3.phpt
new file mode 100644
index 0000000000..935cc5cd0d
--- /dev/null
+++ b/Zend/tests/traits/abstract_method_3.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Private abstract method from trait enforced in class
+--FILE--
+<?php
+
+trait T {
+ abstract private function neededByTheTrait(int $a, string $b);
+}
+
+class C {
+ use T;
+
+ private function neededByTheTrait(array $a, object $b) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of C::neededByTheTrait(array $a, object $b) must be compatible with T::neededByTheTrait(int $a, string $b) in %s on line %d
diff --git a/Zend/tests/traits/abstract_method_4.phpt b/Zend/tests/traits/abstract_method_4.phpt
new file mode 100644
index 0000000000..5b7db22874
--- /dev/null
+++ b/Zend/tests/traits/abstract_method_4.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Visibility enforcement on abstract trait methods
+--FILE--
+<?php
+
+trait T {
+ abstract public function method(int $a, string $b);
+}
+
+class C {
+ use T;
+
+ /* For backwards-compatibility reasons, visibility is not enforced here. */
+ private function method(int $a, string $b) {}
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/traits/abstract_method_5.phpt b/Zend/tests/traits/abstract_method_5.phpt
new file mode 100644
index 0000000000..fa6482aa42
--- /dev/null
+++ b/Zend/tests/traits/abstract_method_5.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Staticness enforcement on abstract trait methods
+--FILE--
+<?php
+
+trait T {
+ abstract static public function method(int $a, string $b);
+}
+
+class C {
+ use T;
+
+ public function method(int $a, string $b) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot make static method T::method() non static in class C in %s on line %d
diff --git a/Zend/tests/traits/abstract_method_6.phpt b/Zend/tests/traits/abstract_method_6.phpt
new file mode 100644
index 0000000000..a8a3fc4138
--- /dev/null
+++ b/Zend/tests/traits/abstract_method_6.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Abstract private trait method not implemented
+--FILE--
+<?php
+
+trait T {
+ abstract private function method(int $a, string $b);
+}
+
+abstract class C {
+ use T;
+}
+
+class D extends C {
+ private function method(int $a, string $b) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Class C must implement 1 abstract private method (C::method) in %s on line %d
diff --git a/Zend/tests/traits/abstract_method_7.phpt b/Zend/tests/traits/abstract_method_7.phpt
new file mode 100644
index 0000000000..5e276eb17d
--- /dev/null
+++ b/Zend/tests/traits/abstract_method_7.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Abstract private trait method forwarded as abstract protected method
+--FILE--
+<?php
+
+trait T {
+ abstract private function method(int $a, string $b);
+}
+
+abstract class C {
+ use T;
+
+ abstract protected function method(int $a, string $b);
+}
+
+class D extends C {
+ protected function method(int $a, string $b) {}
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/traits/abstract_method_8.phpt b/Zend/tests/traits/abstract_method_8.phpt
new file mode 100644
index 0000000000..1893cc2b38
--- /dev/null
+++ b/Zend/tests/traits/abstract_method_8.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Abstract method in trait using "self"
+--FILE--
+<?php
+
+trait T {
+ abstract private function method(self $x): self;
+}
+
+class C {
+ use T;
+
+ private function method(self $x): self {
+ return $this;
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/traits/abstract_method_9.phpt b/Zend/tests/traits/abstract_method_9.phpt
new file mode 100644
index 0000000000..02877c8255
--- /dev/null
+++ b/Zend/tests/traits/abstract_method_9.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Abstract method in trait using "self" (delayed obligation)
+--FILE--
+<?php
+
+spl_autoload_register(function($class) {
+ if ($class == T::class) {
+ trait T {
+ abstract private function method($x): self;
+ }
+ } else if ($class == C::class) {
+ class C {
+ use T;
+
+ private function method($x): D {
+ return new D;
+ }
+ }
+ } else if ($class == D::class) {
+ class D extends C {}
+ }
+});
+
+new C;
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/traits/bug54441.phpt b/Zend/tests/traits/bug54441.phpt
index bb83d12299..195ff09ff2 100644
--- a/Zend/tests/traits/bug54441.phpt
+++ b/Zend/tests/traits/bug54441.phpt
@@ -16,4 +16,4 @@ class Boo {
?>
--EXPECTF--
-Fatal error: The modifiers for the trait alias dontKnow() need to be changed in the same statement in which the alias is defined. Error in %s on line %d
+Fatal error: The modifiers of the trait method dontKnow() are changed, but this method does not exist. Error in %s on line %d
diff --git a/Zend/tests/traits/bug55214.phpt b/Zend/tests/traits/bug55214.phpt
index b27ae02428..35ef7a2087 100644
--- a/Zend/tests/traits/bug55214.phpt
+++ b/Zend/tests/traits/bug55214.phpt
@@ -25,7 +25,7 @@ trait ATrait {
}
trait Indirect {
- use ATrait;
+ use ATrait;
}
class SomeClass {
@@ -33,7 +33,7 @@ class SomeClass {
}
class UsingIndirect {
- use Indirect;
+ use Indirect;
}
$r = SomeClass::get_class_name();
diff --git a/Zend/tests/traits/bug55355.phpt b/Zend/tests/traits/bug55355.phpt
index 22350a281f..6aae316eff 100644
--- a/Zend/tests/traits/bug55355.phpt
+++ b/Zend/tests/traits/bug55355.phpt
@@ -5,16 +5,16 @@ Bug #55355 (Abstract functions required by a trait are not correctly found when
// A trait that has a abstract function
trait ATrait {
- function bar() {
- $this->foo();
- }
- abstract function foo();
+ function bar() {
+ $this->foo();
+ }
+ abstract function foo();
}
// A class on the second level in the
// inheritance chain
class Level2Impl {
- function foo() {}
+ function foo() {}
}
class Level1Indirect extends Level2Impl {}
diff --git a/Zend/tests/traits/bug55372.phpt b/Zend/tests/traits/bug55372.phpt
index e215d968ab..509b672bf2 100644
--- a/Zend/tests/traits/bug55372.phpt
+++ b/Zend/tests/traits/bug55372.phpt
@@ -4,20 +4,20 @@ Bug #55372 (Literal handling in methods is inconsistent, causing memory corrupti
<?php
trait testTrait {
- public function testMethod() {
- if (1) {
- $letters1 = range('a', 'z', 1);
- $letters2 = range('A', 'Z', 1);
- $letters1 = 'foo';
- $letters2 = 'baarr';
- var_dump($letters1);
- var_dump($letters2);
- }
- }
+ public function testMethod() {
+ if (1) {
+ $letters1 = range('a', 'z', 1);
+ $letters2 = range('A', 'Z', 1);
+ $letters1 = 'foo';
+ $letters2 = 'baarr';
+ var_dump($letters1);
+ var_dump($letters2);
+ }
+ }
}
class foo {
- use testTrait;
+ use testTrait;
}
$x = new foo;
diff --git a/Zend/tests/traits/bug55424.phpt b/Zend/tests/traits/bug55424.phpt
index b1fdc8c353..5788056096 100644
--- a/Zend/tests/traits/bug55424.phpt
+++ b/Zend/tests/traits/bug55424.phpt
@@ -3,33 +3,33 @@ Bug #55424 (Method got missing from class when a trait defined an abstract metho
--FILE--
<?php
- trait ATrait
- {
- function setRequired()
- {
- $this->setAttribute();
- }
+ trait ATrait
+ {
+ function setRequired()
+ {
+ $this->setAttribute();
+ }
- abstract function setAttribute();
- }
+ abstract function setAttribute();
+ }
- class Base
- {
- function setAttribute() { }
- }
+ class Base
+ {
+ function setAttribute() { }
+ }
- class MyClass extends Base
- {
- use ATrait;
- }
+ class MyClass extends Base
+ {
+ use ATrait;
+ }
- $i = new Base();
- $i->setAttribute();
+ $i = new Base();
+ $i->setAttribute();
- $t = new MyClass();
- /* setAttribute used to disappear for no good reason. */
- $t->setRequired();
- echo 'DONE';
+ $t = new MyClass();
+ /* setAttribute used to disappear for no good reason. */
+ $t->setRequired();
+ echo 'DONE';
?>
--EXPECT--
DONE
diff --git a/Zend/tests/traits/bug55524.phpt b/Zend/tests/traits/bug55524.phpt
index 9fe36d7a80..d37737aaca 100644
--- a/Zend/tests/traits/bug55524.phpt
+++ b/Zend/tests/traits/bug55524.phpt
@@ -12,4 +12,4 @@ trait Foo extends Base {
echo 'DONE';
?>
--EXPECTF--
-Parse error: syntax error, unexpected 'extends' (T_EXTENDS), expecting '{' in %s on line %d
+Parse error: syntax error, unexpected token "extends", expecting "{" in %s on line %d
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/bug60145.phpt b/Zend/tests/traits/bug60145.phpt
index fcd0cfa5f2..afa9e11e4d 100644
--- a/Zend/tests/traits/bug60145.phpt
+++ b/Zend/tests/traits/bug60145.phpt
@@ -8,10 +8,11 @@ trait foo {
}
interface MyInterface {
- use foo;
+ use foo;
- public function b();
+ public function b();
}
+?>
--EXPECTF--
Fatal error: Cannot use traits inside of interfaces. foo is used in MyInterface in %s on line %d
diff --git a/Zend/tests/traits/bug60153.phpt b/Zend/tests/traits/bug60153.phpt
index 5dcc78a878..0b9fe951ba 100644
--- a/Zend/tests/traits/bug60153.phpt
+++ b/Zend/tests/traits/bug60153.phpt
@@ -14,5 +14,6 @@ trait TFoo {
class C implements IFoo {
use TFoo;
}
+?>
--EXPECTF--
Fatal error: Declaration of C::oneArgument() must be compatible with IFoo::oneArgument($a) in %s on line %d
diff --git a/Zend/tests/traits/bug60165a.phpt b/Zend/tests/traits/bug60165a.phpt
index 6bc3352e21..a03b5d8c7e 100644
--- a/Zend/tests/traits/bug60165a.phpt
+++ b/Zend/tests/traits/bug60165a.phpt
@@ -12,5 +12,6 @@ class MyClass {
nonExistent as barA;
}
}
+?>
--EXPECTF--
Fatal error: An alias (barA) was defined for method nonExistent(), but this method does not exist in %s on line %d
diff --git a/Zend/tests/traits/bug60165b.phpt b/Zend/tests/traits/bug60165b.phpt
index ac3f070bd8..30ca028140 100644
--- a/Zend/tests/traits/bug60165b.phpt
+++ b/Zend/tests/traits/bug60165b.phpt
@@ -12,5 +12,6 @@ class MyClass {
A::nonExistent as barA;
}
}
+?>
--EXPECTF--
Fatal error: An alias was defined for A::nonExistent but this method does not exist in %s on line %d
diff --git a/Zend/tests/traits/bug60165c.phpt b/Zend/tests/traits/bug60165c.phpt
index 9a8458d65d..bf36a4598f 100644
--- a/Zend/tests/traits/bug60165c.phpt
+++ b/Zend/tests/traits/bug60165c.phpt
@@ -17,5 +17,6 @@ class MyClass {
baz as foobar;
}
}
+?>
--EXPECTF--
Fatal error: An alias (foobar) was defined for method baz(), but this method does not exist in %s on line %d
diff --git a/Zend/tests/traits/bug60165d.phpt b/Zend/tests/traits/bug60165d.phpt
index 6b4a09d059..b0a68d1d6a 100644
--- a/Zend/tests/traits/bug60165d.phpt
+++ b/Zend/tests/traits/bug60165d.phpt
@@ -16,5 +16,6 @@ class MyClass {
A::bar insteadof B;
}
}
+?>
--EXPECTF--
Fatal error: A precedence rule was defined for A::bar but this method does not exist in %s on line %d
diff --git a/Zend/tests/traits/bug60173.phpt b/Zend/tests/traits/bug60173.phpt
index d4683a9921..be7f652bf9 100644
--- a/Zend/tests/traits/bug60173.phpt
+++ b/Zend/tests/traits/bug60173.phpt
@@ -7,6 +7,7 @@ trait foo { }
$rc = new ReflectionClass('foo');
$rc->newInstance();
+?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot instantiate trait foo in %s:%d
Stack trace:
diff --git a/Zend/tests/traits/bug60217a.phpt b/Zend/tests/traits/bug60217a.phpt
index 20132370c1..c9b4dd4dab 100644
--- a/Zend/tests/traits/bug60217a.phpt
+++ b/Zend/tests/traits/bug60217a.phpt
@@ -21,5 +21,6 @@ class C {
$o = new C;
$o->foo();
+?>
--EXPECT--
C::foo() works.
diff --git a/Zend/tests/traits/bug60217b.phpt b/Zend/tests/traits/bug60217b.phpt
index b349cf2c54..3135be093d 100644
--- a/Zend/tests/traits/bug60217b.phpt
+++ b/Zend/tests/traits/bug60217b.phpt
@@ -21,5 +21,6 @@ class CBroken {
$o = new CBroken;
$o->foo(1);
+?>
--EXPECTF--
-Fatal error: Declaration of TBroken1::foo($a) must be compatible with TBroken2::foo($a, $b = 0) in %s
+Fatal error: Declaration of CBroken::foo($a) must be compatible with TBroken2::foo($a, $b = 0) in %s on line %d
diff --git a/Zend/tests/traits/bug60217c.phpt b/Zend/tests/traits/bug60217c.phpt
index 401444e978..23da36df37 100644
--- a/Zend/tests/traits/bug60217c.phpt
+++ b/Zend/tests/traits/bug60217c.phpt
@@ -21,5 +21,6 @@ class CBroken {
$o = new CBroken;
$o->foo(1);
+?>
--EXPECTF--
-Fatal error: Declaration of TBroken2::foo($a) must be compatible with TBroken1::foo($a, $b = 0) in %s on line %d
+Fatal error: Declaration of CBroken::foo($a) must be compatible with TBroken1::foo($a, $b = 0) in %s on line %d
diff --git a/Zend/tests/traits/bug60717.phpt b/Zend/tests/traits/bug60717.phpt
index d38b1c0c24..dc9175ac67 100644
--- a/Zend/tests/traits/bug60717.phpt
+++ b/Zend/tests/traits/bug60717.phpt
@@ -5,62 +5,62 @@ Bug #60717 (Order of traits in use statement can cause unexpected unresolved abs
namespace HTML
{
- interface Helper
- {
- function text($text);
- function attributes(array $attributes = null);
- function textArea(array $attributes = null, $value);
- }
+ interface Helper
+ {
+ function text($text);
+ function attributes(array $attributes = null);
+ function textArea(?array $attributes, $value);
+ }
- trait TextUTF8
- {
- function text($text) {}
- }
+ trait TextUTF8
+ {
+ function text($text) {}
+ }
- trait TextArea
- {
- function textArea(array $attributes = null, $value) {}
- abstract function attributes(array $attributes = null);
- abstract function text($text);
- }
+ trait TextArea
+ {
+ function textArea(?array $attributes, $value) {}
+ abstract function attributes(array $attributes = null);
+ abstract function text($text);
+ }
- trait HTMLAttributes
- {
- function attributes(array $attributes = null) { }
- abstract function text($text);
- }
+ trait HTMLAttributes
+ {
+ function attributes(array $attributes = null) { }
+ abstract function text($text);
+ }
- class HTMLHelper implements Helper
- {
- use TextArea, HTMLAttributes, TextUTF8;
- }
+ class HTMLHelper implements Helper
+ {
+ use TextArea, HTMLAttributes, TextUTF8;
+ }
- class HTMLHelper2 implements Helper
- {
- use TextArea, TextUTF8, HTMLAttributes;
- }
+ class HTMLHelper2 implements Helper
+ {
+ use TextArea, TextUTF8, HTMLAttributes;
+ }
- class HTMLHelper3 implements Helper
- {
- use HTMLAttributes, TextArea, TextUTF8;
- }
+ class HTMLHelper3 implements Helper
+ {
+ use HTMLAttributes, TextArea, TextUTF8;
+ }
- class HTMLHelper4 implements Helper
- {
- use HTMLAttributes, TextUTF8, TextArea;
- }
+ class HTMLHelper4 implements Helper
+ {
+ use HTMLAttributes, TextUTF8, TextArea;
+ }
- class HTMLHelper5 implements Helper
- {
- use TextUTF8, TextArea, HTMLAttributes;
- }
+ class HTMLHelper5 implements Helper
+ {
+ use TextUTF8, TextArea, HTMLAttributes;
+ }
- class HTMLHelper6 implements Helper
- {
- use TextUTF8, HTMLAttributes, TextArea;
- }
+ class HTMLHelper6 implements Helper
+ {
+ use TextUTF8, HTMLAttributes, TextArea;
+ }
- $o = new HTMLHelper;
+ $o = new HTMLHelper;
$o = new HTMLHelper2;
$o = new HTMLHelper3;
$o = new HTMLHelper4;
@@ -68,5 +68,6 @@ namespace HTML
$o = new HTMLHelper6;
echo 'Done';
}
+?>
--EXPECT--
Done
diff --git a/Zend/tests/traits/bug60809.phpt b/Zend/tests/traits/bug60809.phpt
index 78e7898461..f1a21b1238 100644
--- a/Zend/tests/traits/bug60809.phpt
+++ b/Zend/tests/traits/bug60809.phpt
@@ -3,28 +3,28 @@ Bug #60809 (TRAITS - PHPDoc Comment Style Bug)
--FILE--
<?php
class ExampleParent {
- private $hello_world = "hello foo\n";
- public function foo() {
- echo $this->hello_world;
- }
+ private $hello_world = "hello foo\n";
+ public function foo() {
+ echo $this->hello_world;
+ }
}
class Example extends ExampleParent {
- use ExampleTrait;
+ use ExampleTrait;
}
trait ExampleTrait {
- /**
- *
- */
- private $hello_world = "hello bar\n";
- /**
- *
- */
- public $prop = "ops";
- public function bar() {
- echo $this->hello_world;
- }
+ /**
+ *
+ */
+ private $hello_world = "hello bar\n";
+ /**
+ *
+ */
+ public $prop = "ops";
+ public function bar() {
+ echo $this->hello_world;
+ }
}
$x = new Example();
diff --git a/Zend/tests/traits/bug61052.phpt b/Zend/tests/traits/bug61052.phpt
index 421e9074e5..720d8dcdc7 100644
--- a/Zend/tests/traits/bug61052.phpt
+++ b/Zend/tests/traits/bug61052.phpt
@@ -14,5 +14,6 @@ class C {
}
}
C::foo();
+?>
--EXPECTF--
Fatal error: Inconsistent insteadof definition. The method foo is to be used from T1, but T1 is also on the exclude list in %s on line %d
diff --git a/Zend/tests/traits/bug61998.phpt b/Zend/tests/traits/bug61998.phpt
index 097073892f..2ce251ea81 100644
--- a/Zend/tests/traits/bug61998.phpt
+++ b/Zend/tests/traits/bug61998.phpt
@@ -57,6 +57,7 @@ $b->func2(); //from Bar
$b->newFunc2(); //from T2
$b->newFunc3(); //from T2
$b->func3(); //from Bar
+?>
--EXPECT--
From T1
From Foo
diff --git a/Zend/tests/traits/bug63911.phpt b/Zend/tests/traits/bug63911.phpt
index 72892cdd34..ea2e8067fa 100644
--- a/Zend/tests/traits/bug63911.phpt
+++ b/Zend/tests/traits/bug63911.phpt
@@ -22,5 +22,6 @@ class D
}
(new D)->a();
+?>
--EXPECT--
Done
diff --git a/Zend/tests/traits/bug65576a.phpt b/Zend/tests/traits/bug65576a.phpt
index 51d2463808..33fc1c9227 100644
--- a/Zend/tests/traits/bug65576a.phpt
+++ b/Zend/tests/traits/bug65576a.phpt
@@ -25,5 +25,6 @@ class B extends A
}
new B();
+?>
--EXPECT--
Trait constructor
diff --git a/Zend/tests/traits/bug65576b.phpt b/Zend/tests/traits/bug65576b.phpt
index c13ce8c2e1..41a521b67b 100644
--- a/Zend/tests/traits/bug65576b.phpt
+++ b/Zend/tests/traits/bug65576b.phpt
@@ -26,6 +26,7 @@ class B extends A
}
new B();
+?>
--EXPECT--
Parent constructor
Trait constructor
diff --git a/Zend/tests/traits/bug75607.phpt b/Zend/tests/traits/bug75607.phpt
index e466e6333b..032b7c3d78 100644
--- a/Zend/tests/traits/bug75607.phpt
+++ b/Zend/tests/traits/bug75607.phpt
@@ -5,17 +5,17 @@ Bug #75607 (Comparison of initial static properties failing)
trait T1
{
- public static $prop1 = 1;
+ public static $prop1 = 1;
}
class Base
{
- public static $prop1 = 1;
+ public static $prop1 = 1;
}
class Child extends base
{
- use T1;
+ use T1;
}
echo "DONE";
diff --git a/Zend/tests/traits/bug75607a.phpt b/Zend/tests/traits/bug75607a.phpt
index 12b555f728..fb2ecd410f 100644
--- a/Zend/tests/traits/bug75607a.phpt
+++ b/Zend/tests/traits/bug75607a.phpt
@@ -5,17 +5,17 @@ Bug #75607 (Comparison of initial static properties failing)
trait T1
{
- public static $prop1 = 1;
+ public static $prop1 = 1;
}
trait T2
{
- public static $prop1 = 1;
+ public static $prop1 = 1;
}
class Base
{
- use T1;
+ use T1;
}
class Child extends base
@@ -25,7 +25,7 @@ class Child extends base
class Grand extends Child
{
- use T2;
+ use T2;
}
$c = new Grand();
diff --git a/Zend/tests/traits/bug76539.phpt b/Zend/tests/traits/bug76539.phpt
index 51a75cdaf6..0a6d893032 100644
--- a/Zend/tests/traits/bug76539.phpt
+++ b/Zend/tests/traits/bug76539.phpt
@@ -3,19 +3,19 @@ Bug #76539 (Trait attribute is set incorrectly when using self::class with anoth
--FILE--
<?php
trait MyTrait {
- protected $attr = self::class . 'Test';
+ protected $attr = self::class . 'Test';
- public function test() {
- echo $this->attr, PHP_EOL;
- }
+ public function test() {
+ echo $this->attr, PHP_EOL;
+ }
}
class A {
- use MyTrait;
+ use MyTrait;
}
class B {
- use MyTrait;
+ use MyTrait;
}
(new A())->test();
diff --git a/Zend/tests/traits/bug76700.phpt b/Zend/tests/traits/bug76700.phpt
index a9797f3c9e..e263e9b36f 100644
--- a/Zend/tests/traits/bug76700.phpt
+++ b/Zend/tests/traits/bug76700.phpt
@@ -26,5 +26,6 @@ class B extends A
$b = new B();
$b->aa();
+?>
--EXPECT--
123
diff --git a/Zend/tests/traits/bug76773.phpt b/Zend/tests/traits/bug76773.phpt
index 683952025d..4ab53bf6d1 100644
--- a/Zend/tests/traits/bug76773.phpt
+++ b/Zend/tests/traits/bug76773.phpt
@@ -27,6 +27,7 @@ class ChildClass extends ParentClass
$c = new ChildClass();
$c->hello();
+?>
--EXPECT--
ChildClass
ParentClass
diff --git a/Zend/tests/traits/bugs/abstract-methods01.phpt b/Zend/tests/traits/bugs/abstract-methods01.phpt
index 23cdef3a89..721f965759 100644
--- a/Zend/tests/traits/bugs/abstract-methods01.phpt
+++ b/Zend/tests/traits/bugs/abstract-methods01.phpt
@@ -9,7 +9,7 @@ trait THello {
}
class TraitsTest {
- use THello;
+ use THello;
}
$test = new TraitsTest();
diff --git a/Zend/tests/traits/bugs/abstract-methods02.phpt b/Zend/tests/traits/bugs/abstract-methods02.phpt
index 73bb65d179..3bf263f5fa 100644
--- a/Zend/tests/traits/bugs/abstract-methods02.phpt
+++ b/Zend/tests/traits/bugs/abstract-methods02.phpt
@@ -15,8 +15,8 @@ trait THelloImpl {
}
class TraitsTest {
- use THello;
- use THelloImpl;
+ use THello;
+ use THelloImpl;
}
$test = new TraitsTest();
diff --git a/Zend/tests/traits/bugs/abstract-methods04.phpt b/Zend/tests/traits/bugs/abstract-methods04.phpt
index d15bdd9473..0ae3137657 100644
--- a/Zend/tests/traits/bugs/abstract-methods04.phpt
+++ b/Zend/tests/traits/bugs/abstract-methods04.phpt
@@ -11,21 +11,21 @@ trait THello {
trait THelloImpl {
public function hello() {
- echo 'Hello';
+ echo 'Hello';
}
}
class TraitsTest1 {
- use THello;
- use THelloImpl;
+ use THello;
+ use THelloImpl;
}
$test = new TraitsTest1();
$test->hello();
class TraitsTest2 {
- use THelloImpl;
- use THello;
+ use THelloImpl;
+ use THello;
}
$test = new TraitsTest2();
diff --git a/Zend/tests/traits/bugs/abstract-methods05.phpt b/Zend/tests/traits/bugs/abstract-methods05.phpt
index b40cbe30a6..96619eae91 100644
--- a/Zend/tests/traits/bugs/abstract-methods05.phpt
+++ b/Zend/tests/traits/bugs/abstract-methods05.phpt
@@ -6,7 +6,7 @@ error_reporting(E_ALL);
trait THelloB {
public function hello() {
- echo 'Hello';
+ echo 'Hello';
}
}
@@ -15,8 +15,8 @@ trait THelloA {
}
class TraitsTest1 {
- use THelloB;
- use THelloA;
+ use THelloB;
+ use THelloA;
}
diff --git a/Zend/tests/traits/bugs/abstract-methods06.phpt b/Zend/tests/traits/bugs/abstract-methods06.phpt
index d8d4994f66..8e2f25b048 100644
--- a/Zend/tests/traits/bugs/abstract-methods06.phpt
+++ b/Zend/tests/traits/bugs/abstract-methods06.phpt
@@ -15,8 +15,8 @@ trait THelloA {
}
class TraitsTest1 {
- use THelloA;
- use THelloB;
+ use THelloA;
+ use THelloB;
}
diff --git a/Zend/tests/traits/bugs/alias-semantics.phpt b/Zend/tests/traits/bugs/alias-semantics.phpt
index eec2de1aff..d856d166bd 100644
--- a/Zend/tests/traits/bugs/alias-semantics.phpt
+++ b/Zend/tests/traits/bugs/alias-semantics.phpt
@@ -11,7 +11,7 @@ trait THello {
}
class TraitsTest {
- use THello { a as b; }
+ use THello { a as b; }
}
$test = new TraitsTest();
diff --git a/Zend/tests/traits/bugs/alias-semantics02.phpt b/Zend/tests/traits/bugs/alias-semantics02.phpt
index bcd75d9cf9..4ff6f168f0 100644
--- a/Zend/tests/traits/bugs/alias-semantics02.phpt
+++ b/Zend/tests/traits/bugs/alias-semantics02.phpt
@@ -1,7 +1,7 @@
--TEST--
Semantic of alias operation is to provide an additional identifier for the
method body of the original method.
-It should also work incase the method is fully qualified.
+It should also work in case the method is fully qualified.
--FILE--
<?php
error_reporting(E_ALL);
@@ -13,7 +13,7 @@ trait THello {
}
class TraitsTest {
- use THello { THello::a as b; }
+ use THello { THello::a as b; }
}
$test = new TraitsTest();
diff --git a/Zend/tests/traits/bugs/case-sensitive.phpt b/Zend/tests/traits/bugs/case-sensitive.phpt
index 6a65ccff03..b0a2e4b545 100644
--- a/Zend/tests/traits/bugs/case-sensitive.phpt
+++ b/Zend/tests/traits/bugs/case-sensitive.phpt
@@ -5,19 +5,19 @@ Check for problems with case sensitivity in compositions
error_reporting(E_ALL);
trait A {
- public function M1() {}
- public function M2() {}
+ public function M1() {}
+ public function M2() {}
}
trait B {
- public function M1() {}
- public function M2() {}
+ public function M1() {}
+ public function M2() {}
}
class MyClass {
- use A;
- use B;
+ use A;
+ use B;
}
?>
--EXPECTF--
-Fatal error: Trait method M1 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
+Fatal error: Trait method B::M1 has not been applied as MyClass::M1, because of collision with A::M1 in %s on line %d
diff --git a/Zend/tests/traits/bugs/interfaces.phpt b/Zend/tests/traits/bugs/interfaces.phpt
index 97ec174a7f..39146f97a4 100644
--- a/Zend/tests/traits/bugs/interfaces.phpt
+++ b/Zend/tests/traits/bugs/interfaces.phpt
@@ -5,7 +5,7 @@ Make sure trait does not implement an interface.
error_reporting(E_ALL);
interface MyInterface {
- public function a();
+ public function a();
}
trait THello implements MyInterface {
@@ -16,4 +16,4 @@ trait THello implements MyInterface {
?>
--EXPECTF--
-Parse error: syntax error, unexpected 'implements' (T_IMPLEMENTS), expecting '{' in %s on line %d
+Parse error: syntax error, unexpected token "implements", expecting "{" in %s on line %d
diff --git a/Zend/tests/traits/bugs/missing-trait.phpt b/Zend/tests/traits/bugs/missing-trait.phpt
index d8ede9dfa7..4bf054e889 100644
--- a/Zend/tests/traits/bugs/missing-trait.phpt
+++ b/Zend/tests/traits/bugs/missing-trait.phpt
@@ -12,4 +12,4 @@ $test = new TraitsTest();
?>
--EXPECTF--
-Fatal error: Trait 'THello' not found in %s on line %d
+Fatal error: Trait "THello" not found in %s on line %d
diff --git a/Zend/tests/traits/conflict001.phpt b/Zend/tests/traits/conflict001.phpt
index 11dababdb5..16dd6fc2d5 100644
--- a/Zend/tests/traits/conflict001.phpt
+++ b/Zend/tests/traits/conflict001.phpt
@@ -17,9 +17,9 @@ trait THello2 {
}
class TraitsTest {
- use THello1;
- use THello2;
+ use THello1;
+ use THello2;
}
?>
--EXPECTF--
-Fatal error: Trait method hello has not been applied, because there are collisions with other trait methods on TraitsTest in %s on line %d
+Fatal error: Trait method THello2::hello has not been applied as TraitsTest::hello, because of collision with THello1::hello in %s on line %d
diff --git a/Zend/tests/traits/conflict002.phpt b/Zend/tests/traits/conflict002.phpt
index 1327de1458..377b1b0c45 100644
--- a/Zend/tests/traits/conflict002.phpt
+++ b/Zend/tests/traits/conflict002.phpt
@@ -1,5 +1,5 @@
--TEST--
-Overwridden methods do not cause a conflict.
+Overwritten methods do not cause a conflict.
--FILE--
<?php
error_reporting(E_ALL);
diff --git a/Zend/tests/traits/conflict003.phpt b/Zend/tests/traits/conflict003.phpt
index e274063a6f..23ab97edc6 100644
--- a/Zend/tests/traits/conflict003.phpt
+++ b/Zend/tests/traits/conflict003.phpt
@@ -28,4 +28,4 @@ class Talker {
?>
--EXPECTF--
-Fatal error: Trait method smallTalk has not been applied, because there are collisions with other trait methods on Talker in %s on line %d
+Fatal error: Trait method B::smallTalk has not been applied as Talker::smallTalk, because of collision with A::smallTalk in %s on line %d
diff --git a/Zend/tests/traits/error_001.phpt b/Zend/tests/traits/error_001.phpt
index be4295a6d8..31f2ab15c0 100644
--- a/Zend/tests/traits/error_001.phpt
+++ b/Zend/tests/traits/error_001.phpt
@@ -4,23 +4,23 @@ Trying to use instanceof for a method twice
<?php
trait foo {
- public function foo() {
- return 1;
- }
+ public function foo() {
+ return 1;
+ }
}
trait foo2 {
- public function foo() {
- return 2;
- }
+ public function foo() {
+ return 2;
+ }
}
class A extends foo {
- use foo {
- foo2::foo insteadof foo;
- foo2::foo insteadof foo;
- }
+ use foo {
+ foo2::foo insteadof foo;
+ foo2::foo insteadof foo;
+ }
}
?>
diff --git a/Zend/tests/traits/error_002.phpt b/Zend/tests/traits/error_002.phpt
index ac98769f47..53ad403a43 100644
--- a/Zend/tests/traits/error_002.phpt
+++ b/Zend/tests/traits/error_002.phpt
@@ -4,9 +4,9 @@ Trying to use an undefined trait
<?php
class A {
- use abc;
+ use abc;
}
?>
--EXPECTF--
-Fatal error: Trait 'abc' not found in %s on line %d
+Fatal error: Trait "abc" not found in %s on line %d
diff --git a/Zend/tests/traits/error_003.phpt b/Zend/tests/traits/error_003.phpt
index 23f62d2977..fdfa0ac1fe 100644
--- a/Zend/tests/traits/error_003.phpt
+++ b/Zend/tests/traits/error_003.phpt
@@ -7,7 +7,7 @@ interface abc {
}
class A {
- use abc;
+ use abc;
}
?>
diff --git a/Zend/tests/traits/error_004.phpt b/Zend/tests/traits/error_004.phpt
index 5bfcc263cc..d7ff695e04 100644
--- a/Zend/tests/traits/error_004.phpt
+++ b/Zend/tests/traits/error_004.phpt
@@ -7,7 +7,7 @@ class abc {
}
class A {
- use abc;
+ use abc;
}
?>
diff --git a/Zend/tests/traits/error_005.phpt b/Zend/tests/traits/error_005.phpt
index 99952f70e6..3b8cc32f97 100644
--- a/Zend/tests/traits/error_005.phpt
+++ b/Zend/tests/traits/error_005.phpt
@@ -7,7 +7,7 @@ final class abc {
}
class A {
- use abc;
+ use abc;
}
?>
diff --git a/Zend/tests/traits/error_006.phpt b/Zend/tests/traits/error_006.phpt
index 54083a310f..f3ed87123c 100644
--- a/Zend/tests/traits/error_006.phpt
+++ b/Zend/tests/traits/error_006.phpt
@@ -7,7 +7,7 @@ abstract class abc {
}
class A {
- use abc;
+ use abc;
}
?>
diff --git a/Zend/tests/traits/error_010.phpt b/Zend/tests/traits/error_010.phpt
index de3741ea57..f286cba572 100644
--- a/Zend/tests/traits/error_010.phpt
+++ b/Zend/tests/traits/error_010.phpt
@@ -4,15 +4,15 @@ Trying to exclude trait method multiple times
<?php
trait foo {
- public function test() { return 3; }
+ public function test() { return 3; }
}
trait c {
- public function test() { return 2; }
+ public function test() { return 2; }
}
class bar {
- use foo, c { c::test insteadof foo; }
- use foo, c { c::test insteadof foo; }
+ use foo, c { c::test insteadof foo; }
+ use foo, c { c::test insteadof foo; }
}
$x = new bar;
diff --git a/Zend/tests/traits/error_011.phpt b/Zend/tests/traits/error_011.phpt
index 2d266dd1ec..9fb6bffe8b 100644
--- a/Zend/tests/traits/error_011.phpt
+++ b/Zend/tests/traits/error_011.phpt
@@ -4,18 +4,18 @@ Testing trait collisions
<?php
trait foo {
- public function test() { return 3; }
+ public function test() { return 3; }
}
trait c {
- public function test() { return 2; }
+ public function test() { return 2; }
}
trait b {
- public function test() { return 1; }
+ public function test() { return 1; }
}
class bar {
- use foo, c, b;
+ use foo, c, b;
}
$x = new bar;
@@ -23,4 +23,4 @@ var_dump($x->test());
?>
--EXPECTF--
-Fatal error: Trait method test has not been applied, because there are collisions with other trait methods on bar in %s on line %d
+Fatal error: Trait method c::test has not been applied as bar::test, because of collision with foo::test in %s on line %d
diff --git a/Zend/tests/traits/error_012.phpt b/Zend/tests/traits/error_012.phpt
index 50a454c324..28586e4fde 100644
--- a/Zend/tests/traits/error_012.phpt
+++ b/Zend/tests/traits/error_012.phpt
@@ -4,11 +4,11 @@ Trying to access a protected trait method
<?php
trait foo {
- public function test() { return 3; }
+ public function test() { return 3; }
}
class bar {
- use foo { test as protected; }
+ use foo { test as protected; }
}
$x = new bar;
@@ -16,7 +16,7 @@ var_dump($x->test());
?>
--EXPECTF--
-Fatal error: Uncaught Error: Call to protected method bar::test() from context '' in %s:%d
+Fatal error: Uncaught Error: Call to protected method bar::test() from global scope in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/traits/error_013.phpt b/Zend/tests/traits/error_013.phpt
index d9fda2d005..1fbf607bb7 100644
--- a/Zend/tests/traits/error_013.phpt
+++ b/Zend/tests/traits/error_013.phpt
@@ -4,11 +4,11 @@ Trying to use static as method modifier
<?php
trait foo {
- public function test() { return 3; }
+ public function test() { return 3; }
}
class bar {
- use foo { test as static; }
+ use foo { test as static; }
}
$x = new bar;
diff --git a/Zend/tests/traits/error_014.phpt b/Zend/tests/traits/error_014.phpt
index be1c91977c..3a00124836 100644
--- a/Zend/tests/traits/error_014.phpt
+++ b/Zend/tests/traits/error_014.phpt
@@ -4,15 +4,15 @@ Trying to override final method
<?php
trait foo {
- public function test() { return 3; }
+ public function test() { return 3; }
}
class baz {
- final public function test() { return 4; }
+ final public function test() { return 4; }
}
class bar extends baz {
- use foo { test as public; }
+ use foo { test as public; }
}
$x = new bar;
diff --git a/Zend/tests/traits/error_015.phpt b/Zend/tests/traits/error_015.phpt
index efcffea5f3..c1309bd713 100644
--- a/Zend/tests/traits/error_015.phpt
+++ b/Zend/tests/traits/error_015.phpt
@@ -5,17 +5,17 @@ Should warn about the conflict.
<?php
trait foo {
- public function test() { return 3; }
+ public function test() { return 3; }
}
trait baz {
- public function test() { return 4; }
+ public function test() { return 4; }
}
class bar {
- use foo, baz {
- baz::test as zzz;
- }
+ use foo, baz {
+ baz::test as zzz;
+ }
}
$x = new bar;
@@ -23,4 +23,4 @@ var_dump($x->test());
?>
--EXPECTF--
-Fatal error: Trait method test has not been applied, because there are collisions with other trait methods on bar in %s on line %d
+Fatal error: Trait method baz::test has not been applied as bar::test, because of collision with foo::test in %s on line %d
diff --git a/Zend/tests/traits/error_016.phpt b/Zend/tests/traits/error_016.phpt
index 65a3a83485..191225ddee 100644
--- a/Zend/tests/traits/error_016.phpt
+++ b/Zend/tests/traits/error_016.phpt
@@ -4,7 +4,7 @@ Trying to create a constant on Trait
<?php
trait foo {
- const a = 1;
+ const a = 1;
}
?>
diff --git a/Zend/tests/traits/get_declared_traits_002.phpt b/Zend/tests/traits/get_declared_traits_002.phpt
index 73dd73c927..76e5294536 100644
--- a/Zend/tests/traits/get_declared_traits_002.phpt
+++ b/Zend/tests/traits/get_declared_traits_002.phpt
@@ -4,12 +4,12 @@ Testing get_declared_traits() inside namespace
<?php
namespace test {
- class a { }
- interface b { }
- trait c { }
- abstract class d { }
- final class e { }
- var_dump(get_declared_traits());
+ class a { }
+ interface b { }
+ trait c { }
+ abstract class d { }
+ final class e { }
+ var_dump(get_declared_traits());
}
?>
diff --git a/Zend/tests/traits/inheritance001.phpt b/Zend/tests/traits/inheritance001.phpt
index 60c5fcfc0b..515a8d6e92 100644
--- a/Zend/tests/traits/inheritance001.phpt
+++ b/Zend/tests/traits/inheritance001.phpt
@@ -1,5 +1,5 @@
--TEST--
-Trait method overwridden by a method defined in the class.
+Trait method overwritten by a method defined in the class.
--FILE--
<?php
error_reporting(E_ALL);
diff --git a/Zend/tests/traits/interface_001.phpt b/Zend/tests/traits/interface_001.phpt
index a14f78efc8..46ebf73b57 100644
--- a/Zend/tests/traits/interface_001.phpt
+++ b/Zend/tests/traits/interface_001.phpt
@@ -4,16 +4,16 @@ Using traits to implement interface
<?php
trait foo {
- public function abc() {
- }
+ public function abc() {
+ }
}
interface baz {
- public function abc();
+ public function abc();
}
class bar implements baz {
- use foo;
+ use foo;
}
diff --git a/Zend/tests/traits/interface_002.phpt b/Zend/tests/traits/interface_002.phpt
index 462d73fbd6..bc56a6d68b 100644
--- a/Zend/tests/traits/interface_002.phpt
+++ b/Zend/tests/traits/interface_002.phpt
@@ -4,16 +4,16 @@ Checking error message when the trait doesn't implements the interface
<?php
trait foo {
- public function a() {
- }
+ public function a() {
+ }
}
interface baz {
- public function abc();
+ public function abc();
}
class bar implements baz {
- use foo;
+ use foo;
}
diff --git a/Zend/tests/traits/interface_003.phpt b/Zend/tests/traits/interface_003.phpt
index aa13bd8b59..a1463113eb 100644
--- a/Zend/tests/traits/interface_003.phpt
+++ b/Zend/tests/traits/interface_003.phpt
@@ -4,16 +4,16 @@ Testing to implement Serializable interface by traits
<?php
trait foo {
- public function serialize() {
- return 'foobar';
- }
- public function unserialize($x) {
- var_dump($x);
- }
+ public function serialize() {
+ return 'foobar';
+ }
+ public function unserialize($x) {
+ var_dump($x);
+ }
}
class bar implements Serializable {
- use foo;
+ use foo;
}
var_dump($o = serialize(new bar));
diff --git a/Zend/tests/traits/language001.phpt b/Zend/tests/traits/language001.phpt
index fd9ec2ddc2..efba03458a 100644
--- a/Zend/tests/traits/language001.phpt
+++ b/Zend/tests/traits/language001.phpt
@@ -11,7 +11,7 @@ trait THello {
}
class TraitsTest {
- use THello;
+ use THello;
}
$test = new TraitsTest();
diff --git a/Zend/tests/traits/language004.phpt b/Zend/tests/traits/language004.phpt
index 76959d011d..167738b844 100644
--- a/Zend/tests/traits/language004.phpt
+++ b/Zend/tests/traits/language004.phpt
@@ -19,7 +19,7 @@ trait World {
class MyHelloWorld {
use Hello, World {
Hello::saySomething insteadof World;
- World::saySomething as sayWorld;
+ World::saySomething as sayWorld;
}
}
diff --git a/Zend/tests/traits/language005.phpt b/Zend/tests/traits/language005.phpt
index 762c1e4ac5..9b5aa2b551 100644
--- a/Zend/tests/traits/language005.phpt
+++ b/Zend/tests/traits/language005.phpt
@@ -24,10 +24,10 @@ trait B {
class Talker {
use A, B {
- B::smallTalk insteadof A;
- A::bigTalk insteadof B;
- B::bigTalk as talk;
- }
+ B::smallTalk insteadof A;
+ A::bigTalk insteadof B;
+ B::bigTalk as talk;
+ }
}
$t = new Talker;
diff --git a/Zend/tests/traits/language007.phpt b/Zend/tests/traits/language007.phpt
index 67cb7f86c2..59265c2d47 100644
--- a/Zend/tests/traits/language007.phpt
+++ b/Zend/tests/traits/language007.phpt
@@ -18,7 +18,7 @@ trait Hello {
}
class MyHelloWorld extends Base {
- use Hello;
+ use Hello;
}
$o = new MyHelloWorld();
diff --git a/Zend/tests/traits/language008a.phpt b/Zend/tests/traits/language008a.phpt
index 2d87de92e8..8a170e665f 100644
--- a/Zend/tests/traits/language008a.phpt
+++ b/Zend/tests/traits/language008a.phpt
@@ -20,7 +20,7 @@ $o->sayHello();
?>
--EXPECTF--
-Fatal error: Uncaught Error: Call to protected method MyClass::sayHello() from context '' in %s:%d
+Fatal error: Uncaught Error: Call to protected method MyClass::sayHello() from global scope in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/traits/language008b.phpt b/Zend/tests/traits/language008b.phpt
index e40ff59282..33bea34f78 100644
--- a/Zend/tests/traits/language008b.phpt
+++ b/Zend/tests/traits/language008b.phpt
@@ -27,7 +27,7 @@ $o->sayHelloWorld();
?>
--EXPECTF--
Hello World!Hello World!
-Fatal error: Uncaught Error: Call to private method MyClass::sayHelloWorld() from context '' in %s:%d
+Fatal error: Uncaught Error: Call to private method MyClass::sayHelloWorld() from global scope in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/traits/language009.phpt b/Zend/tests/traits/language009.phpt
index 0672532195..60db67b8e0 100644
--- a/Zend/tests/traits/language009.phpt
+++ b/Zend/tests/traits/language009.phpt
@@ -24,8 +24,8 @@ trait C {
class MyClass {
use C, A, B {
- B::foo insteadof A, C;
- }
+ B::foo insteadof A, C;
+ }
}
$t = new MyClass;
diff --git a/Zend/tests/traits/language010.phpt b/Zend/tests/traits/language010.phpt
index cd518f43e2..a5e85d0796 100644
--- a/Zend/tests/traits/language010.phpt
+++ b/Zend/tests/traits/language010.phpt
@@ -27,4 +27,4 @@ $o->world();
?>
--EXPECTF--
-Fatal error: Trait method world has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
+Fatal error: Trait method World::world has not been applied as MyClass::world, because of collision with Hello::world in %s on line %d
diff --git a/Zend/tests/traits/language011.phpt b/Zend/tests/traits/language011.phpt
index 44de874705..6b66da86ce 100644
--- a/Zend/tests/traits/language011.phpt
+++ b/Zend/tests/traits/language011.phpt
@@ -18,7 +18,7 @@ trait World {
class MyClass {
- use Hello, World { sayHello as sayWorld; }
+ use Hello, World { World::sayHello as sayWorld; }
}
$o = new MyClass();
@@ -27,4 +27,4 @@ $o->sayWorld();
?>
--EXPECTF--
-Fatal error: Trait method sayHello has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
+Fatal error: Trait method World::sayHello has not been applied as MyClass::sayHello, because of collision with Hello::sayHello in %s on line %d
diff --git a/Zend/tests/traits/language014.phpt b/Zend/tests/traits/language014.phpt
index 20dcdea7c8..2e1046fc3d 100644
--- a/Zend/tests/traits/language014.phpt
+++ b/Zend/tests/traits/language014.phpt
@@ -27,4 +27,4 @@ $o->world();
?>
--EXPECTF--
-Fatal error: Trait method hello has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
+Fatal error: Trait method World::world has not been applied as MyClass::hello, because of collision with Hello::hello in %s on line %d
diff --git a/Zend/tests/traits/language015.phpt b/Zend/tests/traits/language015.phpt
index 0c9fb4afb2..d8fcd593b6 100644
--- a/Zend/tests/traits/language015.phpt
+++ b/Zend/tests/traits/language015.phpt
@@ -3,15 +3,16 @@ Invalid conflict resolution (unused trait as lhs of "insteadof")
--FILE--
<?php
trait T1 {
- function foo() {echo "T1\n";}
+ function foo() {echo "T1\n";}
}
trait T2 {
function foo() {echo "T2\n";}
}
class C {
- use T1 {
- T2::foo insteadof T1;
- }
+ use T1 {
+ T2::foo insteadof T1;
+ }
}
+?>
--EXPECTF--
Fatal error: Required Trait T2 wasn't added to C in %slanguage015.php on line %d
diff --git a/Zend/tests/traits/language016.phpt b/Zend/tests/traits/language016.phpt
index 1c6bbeabac..0239ae342d 100644
--- a/Zend/tests/traits/language016.phpt
+++ b/Zend/tests/traits/language016.phpt
@@ -3,15 +3,16 @@ Invalid conflict resolution (unused trait as rhs of "insteadof")
--FILE--
<?php
trait T1 {
- function foo() {echo "T1\n";}
+ function foo() {echo "T1\n";}
}
trait T2 {
function foo() {echo "T2\n";}
}
class C {
- use T1 {
- T1::foo insteadof T2;
- }
+ use T1 {
+ T1::foo insteadof T2;
+ }
}
+?>
--EXPECTF--
Fatal error: Required Trait T2 wasn't added to C in %slanguage016.php on line %d
diff --git a/Zend/tests/traits/language017.phpt b/Zend/tests/traits/language017.phpt
index 539a05d02f..12a1643450 100644
--- a/Zend/tests/traits/language017.phpt
+++ b/Zend/tests/traits/language017.phpt
@@ -3,15 +3,16 @@ Invalid conflict resolution (unused trait as lhs of "as")
--FILE--
<?php
trait T1 {
- function foo() {echo "T1\n";}
+ function foo() {echo "T1\n";}
}
trait T2 {
function foo() {echo "T2\n";}
}
class C {
- use T1 {
- T2::foo as private;
- }
+ use T1 {
+ T2::foo as private;
+ }
}
+?>
--EXPECTF--
Fatal error: Required Trait T2 wasn't added to C in %slanguage017.php on line %d
diff --git a/Zend/tests/traits/language018.phpt b/Zend/tests/traits/language018.phpt
index 169cb50c6b..714794a296 100644
--- a/Zend/tests/traits/language018.phpt
+++ b/Zend/tests/traits/language018.phpt
@@ -3,12 +3,12 @@ abstract alias
--FILE--
<?php
trait T1 {
- function foo() {}
+ function foo() {}
}
class C1 {
- use T1 {
- T1::foo as abstract;
- }
+ use T1 {
+ T1::foo as abstract;
+ }
}
?>
--EXPECTF--
diff --git a/Zend/tests/traits/language019.phpt b/Zend/tests/traits/language019.phpt
index 83318c58a2..7764054ebd 100644
--- a/Zend/tests/traits/language019.phpt
+++ b/Zend/tests/traits/language019.phpt
@@ -3,12 +3,12 @@ final alias
--FILE--
<?php
trait T1 {
- function foo() {}
+ function foo() {}
}
class C1 {
- use T1 {
- T1::foo as final;
- }
+ use T1 {
+ T1::foo as final;
+ }
}
?>
--EXPECTF--
diff --git a/Zend/tests/traits/methods_001.phpt b/Zend/tests/traits/methods_001.phpt
index 758234f2d5..8f44898cee 100644
--- a/Zend/tests/traits/methods_001.phpt
+++ b/Zend/tests/traits/methods_001.phpt
@@ -4,25 +4,25 @@ Testing magic method on trait
<?php
trait foo {
- public function __toString() {
- return '123';
- }
+ public function __toString() {
+ return '123';
+ }
- public function __get($x) {
- var_dump($x);
- }
+ public function __get($x) {
+ var_dump($x);
+ }
- public function __set($attr, $val) {
- var_dump($attr .'==='. $val);
- }
+ public function __set($attr, $val) {
+ var_dump($attr .'==='. $val);
+ }
- public function __clone() {
- var_dump(__FUNCTION__);
- }
+ public function __clone() {
+ var_dump(__FUNCTION__);
+ }
}
class bar {
- use foo;
+ use foo;
}
$o = new bar;
diff --git a/Zend/tests/traits/methods_002.phpt b/Zend/tests/traits/methods_002.phpt
index 2a4215fb2c..2c72f6c5a6 100644
--- a/Zend/tests/traits/methods_002.phpt
+++ b/Zend/tests/traits/methods_002.phpt
@@ -4,20 +4,20 @@ Testing collision with magic methods
<?php
trait foo {
- public function __clone() {
- var_dump(__FUNCTION__);
- }
+ public function __clone() {
+ var_dump(__FUNCTION__);
+ }
}
trait baz {
- public function __clone() {
- var_dump(__FUNCTION__);
- }
+ public function __clone() {
+ var_dump(__FUNCTION__);
+ }
}
class bar {
- use foo;
- use baz;
+ use foo;
+ use baz;
}
$o = new bar;
@@ -25,4 +25,4 @@ var_dump(clone $o);
?>
--EXPECTF--
-Fatal error: Trait method __clone has not been applied, because there are collisions with other trait methods on bar in %s on line %d
+Fatal error: Trait method baz::__clone has not been applied as bar::__clone, because of collision with foo::__clone in %s on line %d
diff --git a/Zend/tests/traits/methods_003.phpt b/Zend/tests/traits/methods_003.phpt
index d050b1135f..27df5fe5a6 100644
--- a/Zend/tests/traits/methods_003.phpt
+++ b/Zend/tests/traits/methods_003.phpt
@@ -4,16 +4,16 @@ Testing __construct and __destruct with Trait
<?php
trait foo {
- public function __construct() {
- var_dump(__FUNCTION__);
- }
- public function __destruct() {
- var_dump(__FUNCTION__);
- }
+ public function __construct() {
+ var_dump(__FUNCTION__);
+ }
+ public function __destruct() {
+ var_dump(__FUNCTION__);
+ }
}
class bar {
- use foo;
+ use foo;
}
new bar;
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/traits/property001.phpt b/Zend/tests/traits/property001.phpt
index 291037da07..a7c3fb51dd 100644
--- a/Zend/tests/traits/property001.phpt
+++ b/Zend/tests/traits/property001.phpt
@@ -15,15 +15,15 @@ trait THello2 {
echo "PRE-CLASS-GUARD-TraitsTest\n";
class TraitsTest {
- use THello1;
- use THello2;
+ use THello1;
+ use THello2;
}
echo "PRE-CLASS-GUARD-TraitsTest2\n";
class TraitsTest2 {
- use THello1;
- use THello2;
+ use THello1;
+ use THello2;
}
var_dump(property_exists('TraitsTest', 'foo'));
diff --git a/Zend/tests/traits/property002.phpt b/Zend/tests/traits/property002.phpt
index ecd04fb332..4a9219219f 100644
--- a/Zend/tests/traits/property002.phpt
+++ b/Zend/tests/traits/property002.phpt
@@ -12,11 +12,11 @@ trait THello2 {
}
class TraitsTest {
- use THello1;
- use THello2;
- function test() {
- echo $this->hello . ' ' . $this->world;
- }
+ use THello1;
+ use THello2;
+ function test() {
+ echo $this->hello . ' ' . $this->world;
+ }
}
var_dump(property_exists('TraitsTest', 'hello'));
diff --git a/Zend/tests/traits/property003.phpt b/Zend/tests/traits/property003.phpt
index 5a2863cfe1..881edb53f2 100644
--- a/Zend/tests/traits/property003.phpt
+++ b/Zend/tests/traits/property003.phpt
@@ -14,8 +14,8 @@ trait THello2 {
echo "PRE-CLASS-GUARD\n";
class TraitsTest {
- use THello1;
- use THello2;
+ use THello1;
+ use THello2;
}
echo "POST-CLASS-GUARD\n";
diff --git a/Zend/tests/traits/property004.phpt b/Zend/tests/traits/property004.phpt
index 53dca02e02..5734b83e2b 100644
--- a/Zend/tests/traits/property004.phpt
+++ b/Zend/tests/traits/property004.phpt
@@ -14,11 +14,11 @@ trait THello2 {
echo "PRE-CLASS-GUARD\n";
class TraitsTest {
- use THello1;
- use THello2;
- public function getHello() {
- return $this->hello;
- }
+ use THello1;
+ use THello2;
+ public function getHello() {
+ return $this->hello;
+ }
}
$t = new TraitsTest;
diff --git a/Zend/tests/traits/property005.phpt b/Zend/tests/traits/property005.phpt
index 5bdbfcdaba..d0a976cb37 100644
--- a/Zend/tests/traits/property005.phpt
+++ b/Zend/tests/traits/property005.phpt
@@ -21,7 +21,7 @@ echo "POST-CLASS-GUARD\n";
// now we do the test for a fatal error
class TraitsTest {
- use THello1;
+ use THello1;
public $hello;
}
diff --git a/Zend/tests/traits/property009.phpt b/Zend/tests/traits/property009.phpt
index 1b05382c0d..ecdb101351 100644
--- a/Zend/tests/traits/property009.phpt
+++ b/Zend/tests/traits/property009.phpt
@@ -1,5 +1,5 @@
--TEST--
-Handling of public fields with traits needs to have same semantics as with normal inheritance, however, we do add strict warnings since it is easier to run into something unexpeted with changing traits.
+Handling of public fields with traits needs to have same semantics as with normal inheritance, however, we do add strict warnings since it is easier to run into something unexpected with changing traits.
--FILE--
<?php
diff --git a/Zend/tests/traits/static_001.phpt b/Zend/tests/traits/static_001.phpt
index 326481c779..b8e69d1091 100644
--- a/Zend/tests/traits/static_001.phpt
+++ b/Zend/tests/traits/static_001.phpt
@@ -5,17 +5,17 @@ Simas Toleikis simast@gmail.com
--FILE--
<?php
- trait TestTrait {
- public static function test() {
- return 'Test';
- }
- }
+ trait TestTrait {
+ public static function test() {
+ return 'Test';
+ }
+ }
- class A {
- use TestTrait;
- }
+ class A {
+ use TestTrait;
+ }
- echo A::test();
+ echo A::test();
?>
--EXPECT--
diff --git a/Zend/tests/traits/static_002.phpt b/Zend/tests/traits/static_002.phpt
index 5c1a92a806..4a75136c42 100644
--- a/Zend/tests/traits/static_002.phpt
+++ b/Zend/tests/traits/static_002.phpt
@@ -5,18 +5,18 @@ Simas Toleikis simast@gmail.com
--FILE--
<?php
- trait TestTrait {
- public static function test() {
- return 'Test';
- }
- }
+ trait TestTrait {
+ public static function test() {
+ return 'Test';
+ }
+ }
- class A {
- use TestTrait;
- }
+ class A {
+ use TestTrait;
+ }
- $class = "A";
- echo $class::test();
+ $class = "A";
+ echo $class::test();
?>
--EXPECT--
diff --git a/Zend/tests/traits/static_003.phpt b/Zend/tests/traits/static_003.phpt
index 7417083f69..87f4b77aa8 100644
--- a/Zend/tests/traits/static_003.phpt
+++ b/Zend/tests/traits/static_003.phpt
@@ -5,22 +5,22 @@ Simas Toleikis simast@gmail.com
--FILE--
<?php
- trait TestTrait {
- public static function test() {
- return static::$test;
- }
- }
+ trait TestTrait {
+ public static function test() {
+ return static::$test;
+ }
+ }
- class A {
- use TestTrait;
- protected static $test = "Test A";
- }
+ class A {
+ use TestTrait;
+ protected static $test = "Test A";
+ }
- class B extends A {
- protected static $test = "Test B";
- }
+ class B extends A {
+ protected static $test = "Test B";
+ }
- echo B::test();
+ echo B::test();
?>
--EXPECT--
diff --git a/Zend/tests/traits/static_004.phpt b/Zend/tests/traits/static_004.phpt
index ca02a85e80..e7ceea881c 100644
--- a/Zend/tests/traits/static_004.phpt
+++ b/Zend/tests/traits/static_004.phpt
@@ -5,17 +5,17 @@ Simas Toleikis simast@gmail.com
--FILE--
<?php
- trait TestTrait {
- public static function __callStatic($name, $arguments) {
- return $name;
- }
- }
+ trait TestTrait {
+ public static function __callStatic($name, $arguments) {
+ return $name;
+ }
+ }
- class A {
- use TestTrait;
- }
+ class A {
+ use TestTrait;
+ }
- echo A::Test();
+ echo A::Test();
?>
--EXPECT--
diff --git a/Zend/tests/traits/static_forward_static_call.phpt b/Zend/tests/traits/static_forward_static_call.phpt
index 9ba53bf08a..2f66541729 100644
--- a/Zend/tests/traits/static_forward_static_call.phpt
+++ b/Zend/tests/traits/static_forward_static_call.phpt
@@ -5,23 +5,23 @@ Simas Toleikis simast@gmail.com
--FILE--
<?php
- trait TestTrait {
- public static function test() {
- return 'Forwarded '.forward_static_call(array('A', 'test'));
- }
- }
+ trait TestTrait {
+ public static function test() {
+ return 'Forwarded '.forward_static_call(array('A', 'test'));
+ }
+ }
- class A {
- public static function test() {
- return "Test A";
- }
- }
+ class A {
+ public static function test() {
+ return "Test A";
+ }
+ }
- class B extends A {
- use TestTrait;
- }
+ class B extends A {
+ use TestTrait;
+ }
- echo B::test();
+ echo B::test();
?>
--EXPECT--
diff --git a/Zend/tests/traits/static_get_called_class.phpt b/Zend/tests/traits/static_get_called_class.phpt
index b1d8fa3d1e..5f61f8b81b 100644
--- a/Zend/tests/traits/static_get_called_class.phpt
+++ b/Zend/tests/traits/static_get_called_class.phpt
@@ -5,19 +5,19 @@ Simas Toleikis simast@gmail.com
--FILE--
<?php
- trait TestTrait {
- public static function test() {
- return get_called_class();
- }
- }
+ trait TestTrait {
+ public static function test() {
+ return get_called_class();
+ }
+ }
- class A {
- use TestTrait;
- }
+ class A {
+ use TestTrait;
+ }
- class B extends A { }
+ class B extends A { }
- echo B::test();
+ echo B::test();
?>
--EXPECT--
diff --git a/Zend/tests/traits/trait_constant_001.phpt b/Zend/tests/traits/trait_constant_001.phpt
index 7a5268633e..9521c9267b 100644
--- a/Zend/tests/traits/trait_constant_001.phpt
+++ b/Zend/tests/traits/trait_constant_001.phpt
@@ -4,13 +4,13 @@ __TRAIT__: Basics, a constant denoiting the trait of definition.
<?php
trait TestTrait {
- public static function test() {
- return __TRAIT__;
- }
+ public static function test() {
+ return __TRAIT__;
+ }
}
class Direct {
- use TestTrait;
+ use TestTrait;
}
class IndirectInheritance extends Direct {
diff --git a/Zend/tests/traits/trait_constant_002.phpt b/Zend/tests/traits/trait_constant_002.phpt
index ebd75094e6..4588388671 100644
--- a/Zend/tests/traits/trait_constant_002.phpt
+++ b/Zend/tests/traits/trait_constant_002.phpt
@@ -3,23 +3,23 @@ __TRAIT__: Use outside of traits.
--FILE--
<?php
- class MyClass {
- static function test() {
- return __TRAIT__;
- }
- }
+ class MyClass {
+ static function test() {
+ return __TRAIT__;
+ }
+ }
- function someFun() {
- return __TRAIT__;
- }
+ function someFun() {
+ return __TRAIT__;
+ }
- $t = __TRAIT__;
- var_dump($t);
- $t = MyClass::test();
- var_dump($t);
- $t = someFun();
- var_dump($t);
+ $t = __TRAIT__;
+ var_dump($t);
+ $t = MyClass::test();
+ var_dump($t);
+ $t = someFun();
+ var_dump($t);
?>
--EXPECT--
string(0) ""
diff --git a/Zend/tests/try/bug70228_7.phpt b/Zend/tests/try/bug70228_7.phpt
index 4b8a80351c..531708f86a 100644
--- a/Zend/tests/try/bug70228_7.phpt
+++ b/Zend/tests/try/bug70228_7.phpt
@@ -21,9 +21,7 @@ function foo() {
foo();
?>
-===DONE===
--EXPECT--
int(1)
int(2)
int(3)
-===DONE===
diff --git a/Zend/tests/try/bug70228_8.phpt b/Zend/tests/try/bug70228_8.phpt
index ad13113c71..6e8533414f 100644
--- a/Zend/tests/try/bug70228_8.phpt
+++ b/Zend/tests/try/bug70228_8.phpt
@@ -9,9 +9,9 @@ function foo() {
var_dump($value);
try {
try {
- switch (str_repeat("b", 2)) {
- case "bb":
- return str_repeat("a", 2);
+ switch (str_repeat("b", 2)) {
+ case "bb":
+ return str_repeat("a", 2);
}
} finally {
throw new Exception;
@@ -22,9 +22,7 @@ function foo() {
foo();
?>
-===DONE===
--EXPECT--
int(1)
int(2)
int(3)
-===DONE===
diff --git a/Zend/tests/try/bug72213.phpt b/Zend/tests/try/bug72213.phpt
index 624050295e..50555f53e4 100644
--- a/Zend/tests/try/bug72213.phpt
+++ b/Zend/tests/try/bug72213.phpt
@@ -3,21 +3,21 @@ Bug #72213 (Finally leaks on nested exceptions)
--FILE--
<?php
function test() {
- try {
- throw new Exception('a');
- } finally {
- try {
- throw new Exception('b');
- } finally {
- }
- }
+ try {
+ throw new Exception('a');
+ } finally {
+ try {
+ throw new Exception('b');
+ } finally {
+ }
+ }
}
try {
- test();
+ test();
} catch (Exception $e) {
- var_dump($e->getMessage());
- var_dump($e->getPrevious()->getMessage());
+ var_dump($e->getMessage());
+ var_dump($e->getPrevious()->getMessage());
}
?>
--EXPECT--
diff --git a/Zend/tests/try/bug72213_2.phpt b/Zend/tests/try/bug72213_2.phpt
index 790abe125d..a9b5f1490b 100644
--- a/Zend/tests/try/bug72213_2.phpt
+++ b/Zend/tests/try/bug72213_2.phpt
@@ -21,5 +21,6 @@ try {
} catch (Exception $e) {
echo "caught {$e->getMessage()}\n";
}
+?>
--EXPECT--
caught 1
diff --git a/Zend/tests/try/bug72629.phpt b/Zend/tests/try/bug72629.phpt
index 034a63b306..f22c955693 100644
--- a/Zend/tests/try/bug72629.phpt
+++ b/Zend/tests/try/bug72629.phpt
@@ -7,9 +7,10 @@ $var = null;
$e = &$var;
try {
- throw new Exception;
+ throw new Exception;
} catch (Exception $e) { }
var_dump($var === $e);
+?>
--EXPECT--
bool(true)
diff --git a/Zend/tests/try/bug74444.phpt b/Zend/tests/try/bug74444.phpt
index 74e0c9d46f..8b0f1dbd6d 100644
--- a/Zend/tests/try/bug74444.phpt
+++ b/Zend/tests/try/bug74444.phpt
@@ -4,73 +4,74 @@ Bug #74444 (multiple catch freezes in some cases)
<?php
function foo()
{
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- echo '';
- try {
- throw new \RuntimeException();
- } catch (\FooEx | \RuntimeException $e) {
- echo 1;
- }
- echo 2;
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ try {
+ throw new \RuntimeException();
+ } catch (\FooEx | \RuntimeException $e) {
+ echo 1;
+ }
+ echo 2;
}
foo();
+?>
--EXPECT--
12
diff --git a/Zend/tests/try/catch_002.phpt b/Zend/tests/try/catch_002.phpt
index 11d736abe2..73284492da 100644
--- a/Zend/tests/try/catch_002.phpt
+++ b/Zend/tests/try/catch_002.phpt
@@ -5,29 +5,27 @@ Catching an exception in a constructor
class MyObject
{
- function __construct()
- {
- throw new Exception();
- echo __METHOD__ . "() Must not be reached\n";
- }
+ function __construct()
+ {
+ throw new Exception();
+ echo __METHOD__ . "() Must not be reached\n";
+ }
- function __destruct()
- {
- echo __METHOD__ . "() Must not be called\n";
- }
+ function __destruct()
+ {
+ echo __METHOD__ . "() Must not be called\n";
+ }
}
try
{
- new MyObject();
+ new MyObject();
}
catch(Exception $e)
{
- echo "Caught\n";
+ echo "Caught\n";
}
?>
-===DONE===
--EXPECT--
Caught
-===DONE===
diff --git a/Zend/tests/try/catch_003.phpt b/Zend/tests/try/catch_003.phpt
index 414d50f815..14ff850123 100644
--- a/Zend/tests/try/catch_003.phpt
+++ b/Zend/tests/try/catch_003.phpt
@@ -5,34 +5,32 @@ Catching an exception in a constructor fired form a static method
class MyObject
{
- function fail()
- {
- throw new Exception();
- }
+ function fail()
+ {
+ throw new Exception();
+ }
- function __construct()
- {
- self::fail();
- echo __METHOD__ . "() Must not be reached\n";
- }
+ function __construct()
+ {
+ self::fail();
+ echo __METHOD__ . "() Must not be reached\n";
+ }
- function __destruct()
- {
- echo __METHOD__ . "() Must not be called\n";
- }
+ function __destruct()
+ {
+ echo __METHOD__ . "() Must not be called\n";
+ }
}
try
{
- new MyObject();
+ new MyObject();
}
catch(Exception $e)
{
- echo "Caught\n";
+ echo "Caught\n";
}
?>
-===DONE===
--EXPECT--
Caught
-===DONE===
diff --git a/Zend/tests/try/catch_004.phpt b/Zend/tests/try/catch_004.phpt
index 7c269cc336..d4f54ce776 100644
--- a/Zend/tests/try/catch_004.phpt
+++ b/Zend/tests/try/catch_004.phpt
@@ -5,39 +5,37 @@ Catching an exception in a constructor inside a static method
class MyObject
{
- function fail()
- {
- throw new Exception();
- }
+ function fail()
+ {
+ throw new Exception();
+ }
- function __construct()
- {
- self::fail();
- echo __METHOD__ . "() Must not be reached\n";
- }
+ function __construct()
+ {
+ self::fail();
+ echo __METHOD__ . "() Must not be reached\n";
+ }
- function __destruct()
- {
- echo __METHOD__ . "() Must not be called\n";
- }
+ function __destruct()
+ {
+ echo __METHOD__ . "() Must not be called\n";
+ }
- static function test()
- {
- try
- {
- new MyObject();
- }
- catch(Exception $e)
- {
- echo "Caught\n";
- }
- }
+ static function test()
+ {
+ try
+ {
+ new MyObject();
+ }
+ catch(Exception $e)
+ {
+ echo "Caught\n";
+ }
+ }
}
MyObject::test();
?>
-===DONE===
--EXPECT--
Caught
-===DONE===
diff --git a/Zend/tests/try/catch_novar_1.phpt b/Zend/tests/try/catch_novar_1.phpt
new file mode 100644
index 0000000000..9b9100c1bf
--- /dev/null
+++ b/Zend/tests/try/catch_novar_1.phpt
@@ -0,0 +1,32 @@
+--TEST--
+catch without capturing a variable
+--FILE--
+<?php
+
+try {
+ throw new Exception();
+} catch (Exception) {
+ echo "Exception\n";
+}
+
+try {
+ throw new Exception();
+} catch (Exception) {
+ echo "Exception\n";
+} catch (Error) {
+ echo "FAIL\n";
+}
+
+try {
+ throw new Exception();
+} catch (Exception|Error) {
+ echo "Exception\n";
+} catch (Throwable) {
+ echo "FAIL\n";
+}
+
+?>
+--EXPECT--
+Exception
+Exception
+Exception
diff --git a/Zend/tests/try/catch_novar_2.phpt b/Zend/tests/try/catch_novar_2.phpt
new file mode 100644
index 0000000000..fa1ada9275
--- /dev/null
+++ b/Zend/tests/try/catch_novar_2.phpt
@@ -0,0 +1,26 @@
+--TEST--
+catch without capturing a variable - exception in destructor
+--FILE--
+<?php
+class ThrowsOnDestruct extends Exception {
+ public function __destruct() {
+ echo "Throwing\n";
+ throw new RuntimeException(__METHOD__);
+ }
+}
+try {
+ throw new ThrowsOnDestruct();
+} catch (Exception) {
+ echo "Unreachable catch\n";
+}
+echo "Unreachable fallthrough\n";
+
+?>
+--EXPECTF--
+Throwing
+
+Fatal error: Uncaught RuntimeException: ThrowsOnDestruct::__destruct in %s:%d
+Stack trace:
+#0 %s(%d): ThrowsOnDestruct->__destruct()
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/try/finally_goto_001.phpt b/Zend/tests/try/finally_goto_001.phpt
index 990f78d4c7..82bdd1ef9b 100644
--- a/Zend/tests/try/finally_goto_001.phpt
+++ b/Zend/tests/try/finally_goto_001.phpt
@@ -3,8 +3,8 @@ jmp into a finally block 01
--FILE--
<?php
function foo() {
- goto test;
- try {
+ goto test;
+ try {
} finally {
test:
}
diff --git a/Zend/tests/try/finally_goto_002.phpt b/Zend/tests/try/finally_goto_002.phpt
index a6bd9e307f..9e00c68fe0 100644
--- a/Zend/tests/try/finally_goto_002.phpt
+++ b/Zend/tests/try/finally_goto_002.phpt
@@ -3,8 +3,8 @@ jmp into a finally block 02
--FILE--
<?php
function foo() {
- try {
- goto test;
+ try {
+ goto test;
} finally {
test:
}
diff --git a/Zend/tests/try/finally_goto_003.phpt b/Zend/tests/try/finally_goto_003.phpt
index 9f4115fee6..b79b01435e 100644
--- a/Zend/tests/try/finally_goto_003.phpt
+++ b/Zend/tests/try/finally_goto_003.phpt
@@ -3,9 +3,9 @@ jmp into a finally block 03
--FILE--
<?php
function foo() {
- try {
+ try {
} finally {
- goto test;
+ goto test;
test:
}
}
diff --git a/Zend/tests/try/finally_goto_004.phpt b/Zend/tests/try/finally_goto_004.phpt
index d88ceedf52..a3a505acba 100644
--- a/Zend/tests/try/finally_goto_004.phpt
+++ b/Zend/tests/try/finally_goto_004.phpt
@@ -3,11 +3,11 @@ jmp into a finally block 03
--FILE--
<?php
function foo() {
- try {
+ try {
} finally {
test:
}
- goto test;
+ goto test;
}
?>
--EXPECTF--
diff --git a/Zend/tests/try/finally_goto_005.phpt b/Zend/tests/try/finally_goto_005.phpt
index 36b4155d81..ffb0e68be1 100644
--- a/Zend/tests/try/finally_goto_005.phpt
+++ b/Zend/tests/try/finally_goto_005.phpt
@@ -4,10 +4,10 @@ There must be a difference between label: try { ... } and try { label: ... }
<?php
label: try {
- goto label;
+ goto label;
} finally {
- print "success";
- return; // don't loop
+ print "success";
+ return; // don't loop
}
?>
diff --git a/Zend/tests/try/try_catch_finally_006.phpt b/Zend/tests/try/try_catch_finally_006.phpt
index d6466ab5a7..d8516028ec 100644
--- a/Zend/tests/try/try_catch_finally_006.phpt
+++ b/Zend/tests/try/try_catch_finally_006.phpt
@@ -13,7 +13,7 @@ function foo($ex = NULL) {
if ($ex) throw $ex;
}
} catch (Exception $e) {
- var_dump("catched");
+ var_dump("caught");
if ($ex) return "return1";
} finally {
var_dump("finally2");
@@ -34,6 +34,6 @@ string(8) "finally2"
string(5) "label"
string(7) "return2"
string(8) "finally1"
-string(7) "catched"
+string(6) "caught"
string(8) "finally2"
string(7) "return1"
diff --git a/Zend/tests/try/try_catch_finally_007.phpt b/Zend/tests/try/try_catch_finally_007.phpt
index 7c2d5ea125..1885f845e9 100644
--- a/Zend/tests/try/try_catch_finally_007.phpt
+++ b/Zend/tests/try/try_catch_finally_007.phpt
@@ -20,7 +20,7 @@ function foo($ret = FALSE) {
} catch (Exception $e) {
goto local;
local:
- var_dump("catched");
+ var_dump("caught");
if ($ret) return "return";
} finally {
var_dump("finally2");
@@ -36,11 +36,11 @@ var_dump(foo(true));
?>
--EXPECT--
string(8) "finally1"
-string(7) "catched"
+string(6) "caught"
string(8) "finally2"
string(5) "label"
NULL
string(8) "finally1"
-string(7) "catched"
+string(6) "caught"
string(8) "finally2"
string(6) "return"
diff --git a/Zend/tests/try/try_finally_010.phpt b/Zend/tests/try/try_finally_010.phpt
index 91eb7821ee..761cbc7f63 100644
--- a/Zend/tests/try/try_finally_010.phpt
+++ b/Zend/tests/try/try_finally_010.phpt
@@ -3,28 +3,29 @@ Try finally (function call in the finally block after exception)
--FILE--
<?php
function foo() {
- echo "4";
+ echo "4";
}
function bar() {
- try {
- echo "2";
- throw new Exception();
- echo "x";
- } catch (MyEx $ex) {
- echo "x";
- } finally {
- echo "3";
- foo();
- echo "5";
- }
+ try {
+ echo "2";
+ throw new Exception();
+ echo "x";
+ } catch (MyEx $ex) {
+ echo "x";
+ } finally {
+ echo "3";
+ foo();
+ echo "5";
+ }
}
try {
- echo "1";
- bar();
- echo "x";
+ echo "1";
+ bar();
+ echo "x";
} catch (Exception $ex) {
- echo "6";
+ echo "6";
}
echo "\n";
+?>
--EXPECT--
123456
diff --git a/Zend/tests/try/try_finally_011.phpt b/Zend/tests/try/try_finally_011.phpt
index 8a9dc62ca4..1262edfef2 100644
--- a/Zend/tests/try/try_finally_011.phpt
+++ b/Zend/tests/try/try_finally_011.phpt
@@ -3,10 +3,10 @@ Try finally (segfault with empty break)
--FILE--
<?php
function foo () {
- try {
- break;
- } finally {
- }
+ try {
+ break;
+ } finally {
+ }
}
foo();
diff --git a/Zend/tests/try/try_finally_012.phpt b/Zend/tests/try/try_finally_012.phpt
index a099ed3d6b..c83bcdacbd 100644
--- a/Zend/tests/try/try_finally_012.phpt
+++ b/Zend/tests/try/try_finally_012.phpt
@@ -3,27 +3,27 @@ Try finally (exception in "return" statement)
--FILE--
<?php
class A {
- public $x = 1;
- public $y = 2;
- function __destruct() {
- throw new Exception();
- }
+ public $x = 1;
+ public $y = 2;
+ function __destruct() {
+ throw new Exception();
+ }
}
function foo() {
- foreach(new A() as $a) {
- try {
- return $a;
- } catch (Exception $e) {
- echo "exception in foo\n";
- } finally {
- echo "finally\n";
- }
- }
+ foreach(new A() as $a) {
+ try {
+ return $a;
+ } catch (Exception $e) {
+ echo "exception in foo\n";
+ } finally {
+ echo "finally\n";
+ }
+ }
}
try {
- foo();
+ foo();
} catch (Exception $e) {
- echo "exception in main\n";
+ echo "exception in main\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/try/try_finally_013.phpt b/Zend/tests/try/try_finally_013.phpt
index a37df5147d..0e82dcbb4c 100644
--- a/Zend/tests/try/try_finally_013.phpt
+++ b/Zend/tests/try/try_finally_013.phpt
@@ -18,8 +18,6 @@ function foo() {
foo();
?>
-===DONE===
--EXPECT--
try
finally
-===DONE===
diff --git a/Zend/tests/try/try_finally_014.phpt b/Zend/tests/try/try_finally_014.phpt
index 284892a8b5..a45f63f1f3 100644
--- a/Zend/tests/try/try_finally_014.phpt
+++ b/Zend/tests/try/try_finally_014.phpt
@@ -20,8 +20,6 @@ function foo() {
foo();
?>
-===DONE===
--EXPECT--
try
finally
-===DONE===
diff --git a/Zend/tests/try/try_finally_015.phpt b/Zend/tests/try/try_finally_015.phpt
index d2580a2e33..f706b9c942 100644
--- a/Zend/tests/try/try_finally_015.phpt
+++ b/Zend/tests/try/try_finally_015.phpt
@@ -21,9 +21,7 @@ function foo() {
foo();
?>
-===DONE===
--EXPECT--
int(1)
int(2)
int(3)
-===DONE===
diff --git a/Zend/tests/try/try_finally_016.phpt b/Zend/tests/try/try_finally_016.phpt
index dc91b42b50..f78a2914af 100644
--- a/Zend/tests/try/try_finally_016.phpt
+++ b/Zend/tests/try/try_finally_016.phpt
@@ -32,8 +32,6 @@ try {
echo "outer catch\n";
}
?>
-===DONE===
--EXPECT--
finally
outer catch
-===DONE===
diff --git a/Zend/tests/try/try_finally_017.phpt b/Zend/tests/try/try_finally_017.phpt
index 5ba58afdea..b23840c611 100644
--- a/Zend/tests/try/try_finally_017.phpt
+++ b/Zend/tests/try/try_finally_017.phpt
@@ -34,9 +34,7 @@ function foo() {
foo();
?>
-===DONE===
--EXPECT--
finally1
catch2
finally2
-===DONE===
diff --git a/Zend/tests/try/try_finally_019.phpt b/Zend/tests/try/try_finally_019.phpt
index 2e2069d1be..2a3c614eba 100644
--- a/Zend/tests/try/try_finally_019.phpt
+++ b/Zend/tests/try/try_finally_019.phpt
@@ -3,13 +3,13 @@ Combination of foreach, finally and goto (call order)
--FILE--
<?php
class A {
- public $n = 0;
- function __construct($n) {
- $this->n = $n;
- }
- function __destruct() {
- echo "destruct" . $this->n . "\n";
- }
+ public $n = 0;
+ function __construct($n) {
+ $this->n = $n;
+ }
+ function __destruct() {
+ echo "destruct" . $this->n . "\n";
+ }
}
foreach ([new A(1)] as $a) {
diff --git a/Zend/tests/try/try_finally_020.phpt b/Zend/tests/try/try_finally_020.phpt
index cfb72d0c55..5fda56bcad 100644
--- a/Zend/tests/try/try_finally_020.phpt
+++ b/Zend/tests/try/try_finally_020.phpt
@@ -3,13 +3,13 @@ Combination of foreach, finally and exception (call order)
--FILE--
<?php
class A {
- public $n = 0;
- function __construct($n) {
- $this->n = $n;
- }
- function __destruct() {
- echo "destruct" . $this->n . "\n";
- }
+ public $n = 0;
+ function __construct($n) {
+ $this->n = $n;
+ }
+ function __destruct() {
+ echo "destruct" . $this->n . "\n";
+ }
}
foreach ([new A(1)] as $a) {
diff --git a/Zend/tests/try/try_finally_021.phpt b/Zend/tests/try/try_finally_021.phpt
index ed162f40d0..d25f393be1 100644
--- a/Zend/tests/try/try_finally_021.phpt
+++ b/Zend/tests/try/try_finally_021.phpt
@@ -6,10 +6,10 @@ $array = [1];
foreach ([0] as $_) {
foreach ($array as $v) {
try {
- echo "ok\n";
+ echo "ok\n";
return;
} finally {
- echo "ok\n";
+ echo "ok\n";
return;
}
}
diff --git a/Zend/tests/try/try_finally_022.phpt b/Zend/tests/try/try_finally_022.phpt
index ff10dead42..7d03264be5 100644
--- a/Zend/tests/try/try_finally_022.phpt
+++ b/Zend/tests/try/try_finally_022.phpt
@@ -3,37 +3,37 @@ Try finally (exception in "return" statement)
--FILE--
<?php
class A {
- public $x = 1;
- public $y = 2;
- function __destruct() {
- throw new Exception();
- }
+ public $x = 1;
+ public $y = 2;
+ function __destruct() {
+ throw new Exception();
+ }
}
try{
- $a = 0;
- switch ($a) {
- case 0:
- }
- switch ($a) {
- case 0:
- }
- switch ($a) {
- case 0:
- }
- foreach([new stdClass()] as $x) {
- foreach(new A() as $a) {
- foreach([new stdClass()] as $y) {
- try {
- if (0) { echo "0" . (int)5; }
- return $a;
- } catch (Exception $e) {
- echo "exception1\n";
- }
- }
- }
- }
+ $a = 0;
+ switch ($a) {
+ case 0:
+ }
+ switch ($a) {
+ case 0:
+ }
+ switch ($a) {
+ case 0:
+ }
+ foreach([new stdClass()] as $x) {
+ foreach(new A() as $a) {
+ foreach([new stdClass()] as $y) {
+ try {
+ if (0) { echo "0" . (int)5; }
+ return $a;
+ } catch (Exception $e) {
+ echo "exception1\n";
+ }
+ }
+ }
+ }
} catch (Exception $e) {
- echo "exception2\n";
+ echo "exception2\n";
}
?>
--EXPECT--
diff --git a/Zend/tests/try/try_multicatch_001.phpt b/Zend/tests/try/try_multicatch_001.phpt
index 0dffd32c72..ae86c743ea 100644
--- a/Zend/tests/try/try_multicatch_001.phpt
+++ b/Zend/tests/try/try_multicatch_001.phpt
@@ -6,11 +6,11 @@ Parsing test
require_once __DIR__ . '/exceptions.inc';
try {
- echo 'TRY' . PHP_EOL;
+ echo 'TRY' . PHP_EOL;
} catch(Exception1 | Exception2 $e) {
- echo 'Exception';
+ echo 'Exception';
} finally {
- echo 'FINALLY' . PHP_EOL;
+ echo 'FINALLY' . PHP_EOL;
}
?>
diff --git a/Zend/tests/try/try_multicatch_002.phpt b/Zend/tests/try/try_multicatch_002.phpt
index 0e70fec7eb..559259bba3 100644
--- a/Zend/tests/try/try_multicatch_002.phpt
+++ b/Zend/tests/try/try_multicatch_002.phpt
@@ -6,12 +6,12 @@ Catch first exception in the multicatch
require_once __DIR__ . '/exceptions.inc';
try {
- echo 'TRY' . PHP_EOL;
- throw new Exception1;
+ echo 'TRY' . PHP_EOL;
+ throw new Exception1;
} catch(Exception1 | Exception2 | Exception3 $e) {
- echo get_class($e) . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
} finally {
- echo 'FINALLY' . PHP_EOL;
+ echo 'FINALLY' . PHP_EOL;
}
?>
diff --git a/Zend/tests/try/try_multicatch_003.phpt b/Zend/tests/try/try_multicatch_003.phpt
index 6aed1a2b09..3bc4dead69 100644
--- a/Zend/tests/try/try_multicatch_003.phpt
+++ b/Zend/tests/try/try_multicatch_003.phpt
@@ -6,12 +6,12 @@ Catch second exception in the multicatch
require_once __DIR__ . '/exceptions.inc';
try {
- echo 'TRY' . PHP_EOL;
- throw new Exception2;
+ echo 'TRY' . PHP_EOL;
+ throw new Exception2;
} catch(Exception1 | Exception2 | Exception3 $e) {
- echo get_class($e) . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
} finally {
- echo 'FINALLY' . PHP_EOL;
+ echo 'FINALLY' . PHP_EOL;
}
?>
diff --git a/Zend/tests/try/try_multicatch_004.phpt b/Zend/tests/try/try_multicatch_004.phpt
index d8b245a767..680c252142 100644
--- a/Zend/tests/try/try_multicatch_004.phpt
+++ b/Zend/tests/try/try_multicatch_004.phpt
@@ -6,12 +6,12 @@ Catch last exception in the multicatch
require_once __DIR__ . '/exceptions.inc';
try {
- echo 'TRY' . PHP_EOL;
- throw new Exception3;
+ echo 'TRY' . PHP_EOL;
+ throw new Exception3;
} catch(Exception1 | Exception2 | Exception3 $e) {
- echo get_class($e) . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
} finally {
- echo 'FINALLY' . PHP_EOL;
+ echo 'FINALLY' . PHP_EOL;
}
?>
diff --git a/Zend/tests/try/try_multicatch_005.phpt b/Zend/tests/try/try_multicatch_005.phpt
index cc3fc890fa..e7bb61b74e 100644
--- a/Zend/tests/try/try_multicatch_005.phpt
+++ b/Zend/tests/try/try_multicatch_005.phpt
@@ -6,16 +6,16 @@ Catch exception in the nested multicatch
require_once __DIR__ . '/exceptions.inc';
try {
- try {
- echo 'TRY' . PHP_EOL;
- throw new Exception3;
- } catch (Exception1 | Exception3 $e) {
- echo get_class($e) . PHP_EOL;
- }
+ try {
+ echo 'TRY' . PHP_EOL;
+ throw new Exception3;
+ } catch (Exception1 | Exception3 $e) {
+ echo get_class($e) . PHP_EOL;
+ }
} catch(Exception2 | Exception3 $e) {
- echo 'Should never be executed';
+ echo 'Should never be executed';
} finally {
- echo 'FINALLY' . PHP_EOL;
+ echo 'FINALLY' . PHP_EOL;
}
?>
diff --git a/Zend/tests/try/try_multicatch_006.phpt b/Zend/tests/try/try_multicatch_006.phpt
index 440e06593c..f0eba8981c 100644
--- a/Zend/tests/try/try_multicatch_006.phpt
+++ b/Zend/tests/try/try_multicatch_006.phpt
@@ -5,14 +5,14 @@ Catch first exception in the second multicatch
require_once __DIR__ . '/exceptions.inc';
try {
- echo 'TRY' . PHP_EOL;
- throw new Exception3;
+ echo 'TRY' . PHP_EOL;
+ throw new Exception3;
} catch(Exception1 | Exception2 $e) {
- echo get_class($e) . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
} catch(Exception3 | Exception4 $e) {
- echo get_class($e) . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
} finally {
- echo 'FINALLY' . PHP_EOL;
+ echo 'FINALLY' . PHP_EOL;
}
?>
--EXPECT--
diff --git a/Zend/tests/try/try_multicatch_007.phpt b/Zend/tests/try/try_multicatch_007.phpt
index 40784108a0..3ec5c64f68 100644
--- a/Zend/tests/try/try_multicatch_007.phpt
+++ b/Zend/tests/try/try_multicatch_007.phpt
@@ -5,14 +5,14 @@ Catch second exception in the second multicatch
require_once __DIR__ . '/exceptions.inc';
try {
- echo 'TRY' . PHP_EOL;
- throw new Exception4;
+ echo 'TRY' . PHP_EOL;
+ throw new Exception4;
} catch(Exception1 | Exception2 $e) {
- echo get_class($e) . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
} catch(Exception3 | Exception4 $e) {
- echo get_class($e) . PHP_EOL;
+ echo get_class($e) . PHP_EOL;
} finally {
- echo 'FINALLY' . PHP_EOL;
+ echo 'FINALLY' . PHP_EOL;
}
?>
--EXPECT--
diff --git a/Zend/tests/type_declarations/array_001.phpt b/Zend/tests/type_declarations/array_001.phpt
index c3315849a2..5739ae1b72 100644
--- a/Zend/tests/type_declarations/array_001.phpt
+++ b/Zend/tests/type_declarations/array_001.phpt
@@ -3,7 +3,7 @@ Array type declaration
--FILE--
<?php
function foo(array $a) {
- echo count($a)."\n";
+ echo count($a)."\n";
}
foo(array(1,2,3));
@@ -12,7 +12,7 @@ foo(123);
--EXPECTF--
3
-Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be of the type array, int given, called in %s on line 7 and defined in %s:2
+Fatal error: Uncaught TypeError: foo(): Argument #1 ($a) must be of type array, int given, called in %s:%d
Stack trace:
#0 %s(%d): foo(123)
#1 {main}
diff --git a/Zend/tests/type_declarations/callable_001.phpt b/Zend/tests/type_declarations/callable_001.phpt
index 3113bedcf0..41b057abf6 100644
--- a/Zend/tests/type_declarations/callable_001.phpt
+++ b/Zend/tests/type_declarations/callable_001.phpt
@@ -14,19 +14,14 @@ $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 +29,9 @@ array(2) {
[1]=>
string(3) "foo"
}
-object(Closure)#%d (0) {
-}
+
+Fatal error: Uncaught TypeError: foo(): Argument #1 ($bar) must be of type callable, array given, called 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/callable_002.phpt b/Zend/tests/type_declarations/callable_002.phpt
index 35564ff1af..ba47cf9ae5 100644
--- a/Zend/tests/type_declarations/callable_002.phpt
+++ b/Zend/tests/type_declarations/callable_002.phpt
@@ -20,7 +20,12 @@ $rc = new ReflectionFunction($closure);
var_dump($rc->getParameters()[0]->isCallable());
?>
---EXPECT--
+--EXPECTF--
+Deprecated: Method ReflectionParameter::isCallable() is deprecated in %s on line %d
bool(true)
+
+Deprecated: Method ReflectionParameter::isCallable() is deprecated in %s on line %d
bool(true)
+
+Deprecated: Method ReflectionParameter::isCallable() is deprecated in %s on line %d
bool(true)
diff --git a/Zend/tests/type_declarations/callable_003.phpt b/Zend/tests/type_declarations/callable_003.phpt
index 3489c32d37..6e6095cd73 100644
--- a/Zend/tests/type_declarations/callable_003.phpt
+++ b/Zend/tests/type_declarations/callable_003.phpt
@@ -4,10 +4,10 @@ callable type#003
<?php
function foo(callable $a, $b, callable $c) {
- var_dump($a, $b, $c);
+ var_dump($a, $b, $c);
}
function bar(callable $a = null) {
- var_dump($a);
+ var_dump($a);
}
foo("strpos", 123, "strpos");
diff --git a/Zend/tests/type_declarations/confusable_type_warning.phpt b/Zend/tests/type_declarations/confusable_type_warning.phpt
new file mode 100644
index 0000000000..44bd173451
--- /dev/null
+++ b/Zend/tests/type_declarations/confusable_type_warning.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Warnings for confusable types
+--FILE--
+<?php
+
+namespace {
+ function test1(integer $x) {}
+ function test2(double $x) {}
+ function test3(boolean $x) {}
+ function test4(resource $x) {}
+}
+
+namespace Foo {
+ use integer as foo;
+
+ function test5(\integer $x) {}
+ function test6(namespace\integer $x) {}
+ function test7(foo $x) {}
+ function test8(boolean $x) {}
+}
+
+namespace Foo {
+ use integer;
+ function test9(integer $x) {}
+}
+
+namespace {
+ use integer as foo;
+
+ function test10(\integer $x) {}
+ function test11(namespace\integer $x) {}
+ function test12(foo $x) {}
+ function test13(boolean $x) {}
+}
+
+?>
+--EXPECTF--
+Warning: "integer" will be interpreted as a class name. Did you mean "int"? Write "\integer" to suppress this warning in %s on line %d
+
+Warning: "double" will be interpreted as a class name. Did you mean "float"? Write "\double" to suppress this warning in %s on line %d
+
+Warning: "boolean" will be interpreted as a class name. Did you mean "bool"? Write "\boolean" to suppress this warning in %s on line %d
+
+Warning: "resource" is not a supported builtin type and will be interpreted as a class name. Write "\resource" to suppress this warning in %s on line %d
+
+Warning: "boolean" will be interpreted as a class name. Did you mean "bool"? Write "\Foo\boolean" or import the class with "use" to suppress this warning in %s on line %d
+
+Warning: "boolean" will be interpreted as a class name. Did you mean "bool"? Write "\boolean" to suppress this warning in %s on line %d
diff --git a/Zend/tests/type_declarations/explicit_weak_include_strict.phpt b/Zend/tests/type_declarations/explicit_weak_include_strict.phpt
index 9773775ae4..60d4159dc2 100644
--- a/Zend/tests/type_declarations/explicit_weak_include_strict.phpt
+++ b/Zend/tests/type_declarations/explicit_weak_include_strict.phpt
@@ -11,7 +11,7 @@ require 'weak_include_strict_2.inc';
// calls within that file should stay strict, despite being included by weak file
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to takes_int() must be of the type int, float given, called in %sweak_include_strict_2.inc on line 9 and defined in %sweak_include_strict_2.inc:5
+Fatal error: Uncaught TypeError: takes_int(): Argument #1 ($x) must be of type int, float given, called in %s:%d
Stack trace:
#0 %s(%d): takes_int(1)
#1 %s(%d): require('%s')
diff --git a/Zend/tests/type_declarations/inexistent_class_hint_with_scalar_arg.phpt b/Zend/tests/type_declarations/inexistent_class_hint_with_scalar_arg.phpt
index 8aec0c009f..d70f7e240a 100644
--- a/Zend/tests/type_declarations/inexistent_class_hint_with_scalar_arg.phpt
+++ b/Zend/tests/type_declarations/inexistent_class_hint_with_scalar_arg.phpt
@@ -8,7 +8,7 @@ foo(null);
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be an instance of bar, null given, called in %s on line %d and defined in %s:%d
+Fatal error: Uncaught TypeError: foo(): Argument #1 ($ex) must be of type bar, null given, called in %s:%d
Stack trace:
#0 %s(%d): foo(NULL)
#1 {main}
diff --git a/Zend/tests/type_declarations/internal_function_strict_mode.phpt b/Zend/tests/type_declarations/internal_function_strict_mode.phpt
index a9e7c9a56b..04c59ae341 100644
--- a/Zend/tests/type_declarations/internal_function_strict_mode.phpt
+++ b/Zend/tests/type_declarations/internal_function_strict_mode.phpt
@@ -6,30 +6,30 @@ declare(strict_types=1);
echo "*** Trying Ord With Integer" . PHP_EOL;
try {
- var_dump(ord(1));
+ var_dump(ord(1));
} catch (TypeError $e) {
- echo "*** Caught " . $e->getMessage() . PHP_EOL;
+ echo "*** Caught " . $e->getMessage() . PHP_EOL;
}
echo "*** Trying Array Map With Invalid Callback" . PHP_EOL;
try {
- array_map([null, "bar"], []);
+ array_map([null, "bar"], []);
} catch (TypeError $e) {
- echo "*** Caught " . $e->getMessage() . PHP_EOL;
+ echo "*** Caught " . $e->getMessage() . PHP_EOL;
}
echo "*** Trying Strlen With Float" . PHP_EOL;
try {
- var_dump(strlen(1.5));
+ var_dump(strlen(1.5));
} catch (TypeError $e) {
- echo "*** Caught " . $e->getMessage() . PHP_EOL;
+ echo "*** Caught " . $e->getMessage() . PHP_EOL;
}
?>
--EXPECT--
*** Trying Ord With Integer
-*** Caught ord() expects parameter 1 to be string, int given
+*** Caught ord(): Argument #1 ($character) must be of type string, int given
*** Trying Array Map With Invalid Callback
-*** Caught array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
+*** Caught array_map(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
*** Trying Strlen With Float
-*** Caught strlen() expects parameter 1 to be string, float given
+*** Caught strlen(): Argument #1 ($str) must be of type string, float given
diff --git a/Zend/tests/type_declarations/iterable_001.phpt b/Zend/tests/type_declarations/iterable_001.phpt
index b6755c49b9..10a001dea0 100644
--- a/Zend/tests/type_declarations/iterable_001.phpt
+++ b/Zend/tests/type_declarations/iterable_001.phpt
@@ -22,6 +22,7 @@ try {
} catch (Throwable $e) {
echo $e->getMessage();
}
+?>
--EXPECTF--
array(3) {
[0]=>
@@ -44,4 +45,4 @@ object(ArrayIterator)#1 (1) {
int(3)
}
}
-Argument 1 passed to test() must be iterable, int given, called in %s on line %d
+test(): Argument #1 ($iterable) must be of type iterable, int given, called 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_003.phpt b/Zend/tests/type_declarations/iterable_003.phpt
index e5e6af9ae8..d2a3bcb368 100644
--- a/Zend/tests/type_declarations/iterable_003.phpt
+++ b/Zend/tests/type_declarations/iterable_003.phpt
@@ -4,10 +4,10 @@ iterable type#003 - Return types
<?php
function foo(): iterable {
- return [];
+ return [];
}
function bar(): iterable {
- return (function () { yield; })();
+ return (function () { yield; })();
}
function baz(): iterable {
@@ -29,4 +29,4 @@ array(0) {
}
object(Generator)#2 (0) {
}
-Return value of baz() must be iterable, int returned
+baz(): Return value must be of type iterable, int returned
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/mixed/casting/mixed_cast_error.phpt b/Zend/tests/type_declarations/mixed/casting/mixed_cast_error.phpt
new file mode 100644
index 0000000000..5deef19234
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/casting/mixed_cast_error.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Test that a mixed casting is not supported
+--FILE--
+<?php
+
+$foo = (mixed) 12;
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected integer "12" in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error1.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error1.phpt
new file mode 100644
index 0000000000..88e4a3da50
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error1.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a mixed parameter type can't be overridden by a built-in type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(mixed $a) {}
+}
+
+class Bar extends Foo
+{
+ public function method(bool $a) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar::method(bool $a) must be compatible with Foo::method(mixed $a) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error2.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error2.phpt
new file mode 100644
index 0000000000..e0a4975f86
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error2.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a mixed parameter type can't be overridden by a nullable built-in type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(mixed $a) {}
+}
+
+class Bar extends Foo
+{
+ public function method(?int $a) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar::method(?int $a) must be compatible with Foo::method(mixed $a) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error3.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error3.phpt
new file mode 100644
index 0000000000..705813d30d
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error3.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a mixed parameter type can't be overridden by a union of all built-in types
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(mixed $a) {}
+}
+
+class Bar extends Foo
+{
+ public function method(bool|int|float|string|array|object|null $a) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar::method(object|array|string|int|float|bool|null $a) must be compatible with Foo::method(mixed $a) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error4.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error4.phpt
new file mode 100644
index 0000000000..5bffe6495e
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_error4.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a mixed parameter type can't be overridden by a union type of classes
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(mixed $a) {}
+}
+
+class Bar extends Foo
+{
+ public function method(stdClass|Foo $a) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar::method(stdClass|Foo $a) must be compatible with Foo::method(mixed $a) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success1.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success1.phpt
new file mode 100644
index 0000000000..7b3403c6de
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that a mixed parameter type supports invariance
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(mixed $a) {}
+}
+
+class Bar extends Foo
+{
+ public function method(mixed $a) {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success2.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success2.phpt
new file mode 100644
index 0000000000..9bbd78a427
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success2.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that a mixed parameter type can be overridden by no type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(mixed $a) {}
+}
+
+class Bar extends Foo
+{
+ public function method($a) {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success3.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success3.phpt
new file mode 100644
index 0000000000..bc3be65688
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success3.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that a parameter of no type can be overridden by the mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method($a) {}
+}
+
+class Bar extends Foo
+{
+ public function method(mixed $a) {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success4.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success4.phpt
new file mode 100644
index 0000000000..365ea6aeb7
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success4.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that a parameter of a built-in type can be overridden by the mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(int $a) {}
+}
+
+class Bar extends Foo
+{
+ public function method(mixed $a) {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success5.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success5.phpt
new file mode 100644
index 0000000000..9cd40776c5
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success5.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that a parameter of a nullable built-in type can be overridden by the mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(?int $a) {}
+}
+
+class Bar extends Foo
+{
+ public function method(mixed $a) {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success6.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success6.phpt
new file mode 100644
index 0000000000..0621d5a872
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success6.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that a parameter of a union of all built-in types can be overridden by the mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(bool|int|float|string|array|object|null $a) {}
+}
+
+class Bar extends Foo
+{
+ public function method(mixed $a) {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success7.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success7.phpt
new file mode 100644
index 0000000000..e5efc82072
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_parameter_inheritance_success7.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that a parameter of a union type of classes can be overridden by the mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(stdClass|Foo $a) {}
+}
+
+class Bar extends Foo
+{
+ public function method(mixed $a) {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error1.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error1.phpt
new file mode 100644
index 0000000000..b1fba7a716
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error1.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a property of mixed type can't be overridden by a property of a built-in type
+--FILE--
+<?php
+
+class Foo
+{
+ public mixed $property1;
+}
+
+class Bar extends Foo
+{
+ public int $property1;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type of Bar::$property1 must be mixed (as in class Foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error2.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error2.phpt
new file mode 100644
index 0000000000..8052dfcec1
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error2.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a property of mixed type can't be overridden by a property of class type
+--FILE--
+<?php
+
+class Foo
+{
+ public mixed $property1;
+}
+
+class Bar extends Foo
+{
+ public stdClass $property1;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type of Bar::$property1 must be mixed (as in class Foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error3.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error3.phpt
new file mode 100644
index 0000000000..4199bcd3a2
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error3.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a property of mixed type can't be overridden by an untyped property
+--FILE--
+<?php
+
+class Foo
+{
+ public mixed $property1;
+}
+
+class Bar extends Foo
+{
+ public $property1;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type of Bar::$property1 must be mixed (as in class Foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error4.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error4.phpt
new file mode 100644
index 0000000000..bc79d757ee
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error4.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a property of mixed type can't be overridden by a property of a union type
+--FILE--
+<?php
+
+class Foo
+{
+ public mixed $property1;
+}
+
+class Bar extends Foo
+{
+ public bool|int|float|string|array|object|null $property1;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type of Bar::$property1 must be mixed (as in class Foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error5.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error5.phpt
new file mode 100644
index 0000000000..8f2c6dc9be
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error5.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a property of a built-in type can't be overridden by a property of mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public int $property1;
+}
+
+class Bar extends Foo
+{
+ public mixed $property1;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type of Bar::$property1 must be int (as in class Foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error6.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error6.phpt
new file mode 100644
index 0000000000..2ba936c119
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error6.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a property of class type can't be overridden by a property of mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public stdClass $property1;
+}
+
+class Bar extends Foo
+{
+ public mixed $property1;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type of Bar::$property1 must be stdClass (as in class Foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error7.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error7.phpt
new file mode 100644
index 0000000000..138952b3df
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error7.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that an untyped property can't be overridden by a property of mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public $property1;
+}
+
+class Bar extends Foo
+{
+ public mixed $property1;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type of Bar::$property1 must not be defined (as in class Foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error8.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error8.phpt
new file mode 100644
index 0000000000..6e564fa4ae
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_error8.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a property of a union type can't be overridden by a property of mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public bool|int|float|string|array|object|null $property1;
+}
+
+class Bar extends Foo
+{
+ public mixed $property1;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type of Bar::$property1 must be object|array|string|int|float|bool|null (as in class Foo) in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_success.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_success.phpt
new file mode 100644
index 0000000000..9f4f4fa546
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_property_inheritance_success.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that a property of mixed property type can be overridden by a property of mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public mixed $property1;
+}
+
+class Bar extends Foo
+{
+ public mixed $property1;
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error1.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error1.phpt
new file mode 100644
index 0000000000..f0cdf26b2d
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error1.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a mixed return type can't be overridden by the void type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(): mixed {}
+}
+
+class Bar extends Foo
+{
+ public function method(): void {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar::method(): void must be compatible with Foo::method(): mixed in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error2.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error2.phpt
new file mode 100644
index 0000000000..1bca4f481a
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error2.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that a mixed return type can't be overridden by no return type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(): mixed {}
+}
+
+class Bar extends Foo
+{
+ public function method() {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar::method() must be compatible with Foo::method(): mixed in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error3.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error3.phpt
new file mode 100644
index 0000000000..a16249ec0b
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_error3.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that the void return type can't be overridden by the mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(): void {}
+}
+
+class Bar extends Foo
+{
+ public function method(): mixed {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of Bar::method(): mixed must be compatible with Foo::method(): void in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success1.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success1.phpt
new file mode 100644
index 0000000000..3b46f4c20f
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that a mixed return value supports invariance
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(): mixed {}
+}
+
+class Bar extends Foo
+{
+ public function method(): mixed {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success2.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success2.phpt
new file mode 100644
index 0000000000..6d0f7efcfd
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success2.phpt
@@ -0,0 +1,57 @@
+--TEST--
+Test that a mixed return type can be overridden by any single (and nullable) type except void
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(): mixed {}
+}
+
+class Bar1 extends Foo
+{
+ public function method(): bool {}
+}
+
+class Bar2 extends Foo
+{
+ public function method(): int {}
+}
+
+class Bar3 extends Foo
+{
+ public function method(): float {}
+}
+
+class Bar4 extends Foo
+{
+ public function method(): string {}
+}
+
+class Bar5 extends Foo
+{
+ public function method(): array {}
+}
+
+class Bar6 extends Foo
+{
+ public function method(): object {}
+}
+
+class Bar7 extends Foo
+{
+ public function method(): stdClass {}
+}
+
+class Bar8 extends Foo
+{
+ public function method(): ?int {}
+}
+
+class Bar9 extends Foo
+{
+ public function method(): ?stdClass {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success3.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success3.phpt
new file mode 100644
index 0000000000..4b11fe2ef0
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success3.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test that a mixed return type can be overridden by any union return type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method(): mixed {}
+}
+
+class Bar1 extends Foo
+{
+ public function method(): bool|int|null {}
+}
+
+class Bar3 extends Foo
+{
+ public function method(): bool|int|float|string|array|object|null {}
+}
+
+class Bar4 extends Foo
+{
+ public function method(): stdClass|Foo {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success4.phpt b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success4.phpt
new file mode 100644
index 0000000000..ce652bc1cb
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/inheritance/mixed_return_inheritance_success4.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that a no return type can be overridden by the mixed type
+--FILE--
+<?php
+
+class Foo
+{
+ public function method() {}
+}
+
+class Bar extends Foo
+{
+ public function method(): mixed {}
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/syntax/mixed_class_error.phpt b/Zend/tests/type_declarations/mixed/syntax/mixed_class_error.phpt
new file mode 100644
index 0000000000..8a5a385576
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/mixed_class_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test that mixed is a reserved class name
+--FILE--
+<?php
+
+class mixed
+{
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use 'mixed' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_error1.phpt b/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_error1.phpt
new file mode 100644
index 0000000000..a240dc3bfc
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_error1.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test that the mixed parameter type can't be used together with any other type
+--FILE--
+<?php
+
+function foo(mixed|int|null $a)
+{
+}
+
+?>
+--EXPECTF--
+Fatal error: Type mixed can only be used as a standalone type in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_error2.phpt b/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_error2.phpt
new file mode 100644
index 0000000000..8f1d172810
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_error2.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test that the nullable mixed parameter type is not valid even though a null default value
+--FILE--
+<?php
+
+function foo(?mixed $a = null)
+{
+}
+
+?>
+--EXPECTF--
+Fatal error: Type mixed cannot be marked as nullable since mixed already includes null in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_success.phpt b/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_success.phpt
new file mode 100644
index 0000000000..91c72686a0
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_success.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test that mixed is a valid parameter type
+--FILE--
+<?php
+
+function foo(mixed $a)
+{
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_sucess4.phpt b/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_sucess4.phpt
new file mode 100644
index 0000000000..89f8bfa543
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/mixed_parameter_sucess4.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Test that the mixed parameter type can have any default value
+--FILE--
+<?php
+
+function foo(mixed $a = null, mixed $b = false, mixed $c = 1, mixed $d = 3.13, mixed $e = "", mixed $f = [])
+{
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/syntax/mixed_return_error.phpt b/Zend/tests/type_declarations/mixed/syntax/mixed_return_error.phpt
new file mode 100644
index 0000000000..7bb8e7d4bb
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/mixed_return_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test that the mixed return type can't be used together with any other type
+--FILE--
+<?php
+
+function foo(): mixed|string|null
+{
+ return null;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type mixed can only be used as a standalone type in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/syntax/mixed_return_success.phpt b/Zend/tests/type_declarations/mixed/syntax/mixed_return_success.phpt
new file mode 100644
index 0000000000..d8b39a80d9
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/mixed_return_success.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test that mixed is a valid return type
+--FILE--
+<?php
+
+function foo(): mixed
+{
+ return null;
+}
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/syntax/mixed_void_return_error.phpt b/Zend/tests/type_declarations/mixed/syntax/mixed_void_return_error.phpt
new file mode 100644
index 0000000000..7c66e310a5
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/mixed_void_return_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test that the mixed|void return type is not valid
+--FILE--
+<?php
+
+function foo(): mixed|void
+{
+ return null;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type mixed can only be used as a standalone type in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/syntax/nullable_mixed_parameter_error.phpt b/Zend/tests/type_declarations/mixed/syntax/nullable_mixed_parameter_error.phpt
new file mode 100644
index 0000000000..f89238ec22
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/nullable_mixed_parameter_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test that the nullable mixed parameter type is not valid
+--FILE--
+<?php
+
+function foo(?mixed $a)
+{
+}
+
+?>
+--EXPECTF--
+Fatal error: Type mixed cannot be marked as nullable since mixed already includes null in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/syntax/nullable_mixed_property_error.phpt b/Zend/tests/type_declarations/mixed/syntax/nullable_mixed_property_error.phpt
new file mode 100644
index 0000000000..f5c8dadce7
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/nullable_mixed_property_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test that the nullable mixed property type is not valid
+--FILE--
+<?php
+
+class Foo
+{
+ public ?mixed $property1;
+}
+
+?>
+--EXPECTF--
+Fatal error: Type mixed cannot be marked as nullable since mixed already includes null in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/syntax/nullable_mixed_return_error.phpt b/Zend/tests/type_declarations/mixed/syntax/nullable_mixed_return_error.phpt
new file mode 100644
index 0000000000..945e7dcc8d
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/syntax/nullable_mixed_return_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test that the nullable mixed return type is not valid
+--FILE--
+<?php
+
+function foo(): ?mixed
+{
+}
+
+?>
+--EXPECTF--
+Fatal error: Type mixed cannot be marked as nullable since mixed already includes null in %s on line %d
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_parameter_strict_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_parameter_strict_success.phpt
new file mode 100644
index 0000000000..01cb09f269
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_parameter_strict_success.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test that the mixed parameter type accepts any kind of arguments in strict mode
+--FILE--
+<?php
+declare(strict_types=1);
+
+function foo(mixed $a)
+{
+}
+
+foo(null);
+foo(false);
+foo(1);
+foo(3.14);
+foo("");
+foo([]);
+foo(new stdClass());
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_parameter_weak_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_parameter_weak_success.phpt
new file mode 100644
index 0000000000..e84a41f45f
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_parameter_weak_success.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test that the mixed parameter type accepts any kind of arguments in weak mode
+--FILE--
+<?php
+
+function foo(mixed $a)
+{
+}
+
+foo(null);
+foo(false);
+foo(1);
+foo(3.14);
+foo("");
+foo([]);
+foo(new stdClass());
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt
new file mode 100644
index 0000000000..8a2c600020
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_property_strict_success.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test that the mixed property type accepts any kind of value in strict mode
+--FILE--
+<?php
+declare(strict_types=1);
+
+class Foo
+{
+ public mixed $property1;
+ public mixed $property2 = null;
+ public mixed $property3 = false;
+ public mixed $property4 = true;
+ public mixed $property5 = 1;
+ public mixed $property6 = 3.14;
+ public mixed $property7 = "foo";
+ public mixed $property8 = [];
+ public mixed $property9;
+
+ public function __construct()
+ {
+ $this->property9 = fopen(__FILE__, "r");
+ $this->property9 = new stdClass();
+ }
+}
+
+$foo = new Foo();
+
+try {
+ $foo->property1;
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+Typed property Foo::$property1 must not be accessed before initialization
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt
new file mode 100644
index 0000000000..e83023d54c
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_property_weak_success.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test that the mixed property type accepts any kind of value in weak mode
+--FILE--
+<?php
+
+class Foo
+{
+ public mixed $property1;
+ public mixed $property2 = null;
+ public mixed $property3 = false;
+ public mixed $property4 = true;
+ public mixed $property5 = 1;
+ public mixed $property6 = 3.14;
+ public mixed $property7 = "foo";
+ public mixed $property8 = [];
+ public mixed $property9;
+
+ public function __construct()
+ {
+ $this->property9 = fopen(__FILE__, "r");
+ $this->property9 = new stdClass();
+ }
+}
+
+$foo = new Foo();
+
+try {
+ $foo->property1;
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+Typed property Foo::$property1 must not be accessed before initialization
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt
new file mode 100644
index 0000000000..2bd775af0a
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test that the mixed return type is not compatible with a void return value in strict mode
+--FILE--
+<?php
+declare(strict_types=1);
+
+function foo(): mixed
+{
+}
+
+try {
+ foo();
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+foo(): Return value must be of type mixed, none returned
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_success.phpt
new file mode 100644
index 0000000000..d9f9ae4ba9
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_return_strict_success.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test that the mixed return type is compatible with any kind of return value in strict mode
+--FILE--
+<?php
+declare(strict_types=1);
+
+function foo($a): mixed
+{
+ return $a;
+}
+
+foo(null);
+foo(false);
+foo(1);
+foo("");
+foo([]);
+foo(new stdClass());
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt
new file mode 100644
index 0000000000..52bd99beb6
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_error.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test that the mixed return type is not compatible with a void return value
+--FILE--
+<?php
+
+function foo(): mixed
+{
+}
+
+try {
+ foo();
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+foo(): Return value must be of type mixed, none returned
diff --git a/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_success.phpt b/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_success.phpt
new file mode 100644
index 0000000000..23f56c13e7
--- /dev/null
+++ b/Zend/tests/type_declarations/mixed/validation/mixed_return_weak_success.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test that the mixed return type is compatible with any kind of return value in weak mode
+--FILE--
+<?php
+
+function foo($a): mixed
+{
+ return $a;
+}
+
+foo(null);
+foo(false);
+foo(1);
+foo("");
+foo([]);
+foo(new stdClass());
+
+?>
+--EXPECT--
diff --git a/Zend/tests/type_declarations/nullable_null.phpt b/Zend/tests/type_declarations/nullable_null.phpt
index 61b05e995b..8991db5e88 100644
--- a/Zend/tests/type_declarations/nullable_null.phpt
+++ b/Zend/tests/type_declarations/nullable_null.phpt
@@ -3,7 +3,7 @@ nullable class
--FILE--
<?php
function test(Foo $a = null) {
- echo "ok\n";
+ echo "ok\n";
}
test(null);
?>
diff --git a/Zend/tests/type_declarations/nullable_void.phpt b/Zend/tests/type_declarations/nullable_void.phpt
index 4ff0edb0d8..725c11bb59 100644
--- a/Zend/tests/type_declarations/nullable_void.phpt
+++ b/Zend/tests/type_declarations/nullable_void.phpt
@@ -8,4 +8,4 @@ function test() : ?void {
?>
--EXPECTF--
-Fatal error: Void type cannot be nullable in %s on line %d
+Fatal error: Void can only be used as a standalone type 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_basic.phpt b/Zend/tests/type_declarations/scalar_basic.phpt
index 1253f48c16..908f1a18b2 100644
--- a/Zend/tests/type_declarations/scalar_basic.phpt
+++ b/Zend/tests/type_declarations/scalar_basic.phpt
@@ -19,7 +19,7 @@ $functions = [
'bool' => function (bool $b) { return $b; }
];
-class Stringable {
+class StringCapable implements Stringable {
public function __toString() {
return "foobar";
}
@@ -40,7 +40,7 @@ $values = [
NULL,
[],
new StdClass,
- new Stringable,
+ new StringCapable,
fopen("data:text/plain,foobar", "r")
];
@@ -74,20 +74,19 @@ int(1)
int(1)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-int(1)
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying int(%d)
int(%d)
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type int, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying bool(true)
int(1)
@@ -96,22 +95,22 @@ int(1)
int(0)
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type int, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type int, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
*** Trying object(stdClass)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#%s (0) {
+*** Trying object(StringCapable)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type int, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
Testing 'float' type:
@@ -128,14 +127,13 @@ float(1)
float(1.5)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-float(1)
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying int(%d)
float(%s)
@@ -150,22 +148,22 @@ float(1)
float(0)
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
*** Trying object(stdClass)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#%s (0) {
+*** Trying object(StringCapable)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
Testing 'string' type:
@@ -203,22 +201,22 @@ string(1) "1"
string(0) ""
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
*** Trying object(stdClass)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#%s (0) {
+*** Trying object(StringCapable)#%s (0) {
}
string(6) "foobar"
*** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
Testing 'bool' type:
@@ -256,21 +254,21 @@ bool(true)
bool(false)
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type bool, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type bool, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
*** Trying object(stdClass)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#%s (0) {
+*** Trying object(StringCapable)#%s (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d
*** Trying resource(%d) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
Done
diff --git a/Zend/tests/type_declarations/scalar_constant_defaults.phpt b/Zend/tests/type_declarations/scalar_constant_defaults.phpt
index b9076c6b52..5e3826de7d 100644
--- a/Zend/tests/type_declarations/scalar_constant_defaults.phpt
+++ b/Zend/tests/type_declarations/scalar_constant_defaults.phpt
@@ -12,31 +12,35 @@ const STRING_ADD_VAL = "this" . " is a test";
const NULL_VAL = null;
function int_val(int $a = INT_VAL): int {
- return $a;
+ return $a;
}
function float_val(float $a = FLOAT_VAL): float {
- return $a;
+ return $a;
}
function string_val(string $a = STRING_VAL): string {
- return $a;
+ return $a;
}
function int_add_val(int $a = INT_ADD_VAL): int {
- return $a;
+ return $a;
}
function float_add_val(float $a = FLOAT_ADD_VAL): float {
- return $a;
+ return $a;
}
function string_add_val(string $a = STRING_ADD_VAL): string {
- return $a;
+ return $a;
}
function int_val_default_null(int $a = NULL_VAL) {
- return $a;
+ return $a;
+}
+
+function nullable_int_val_default_null(?int $a = NULL_VAL) {
+ return $a;
}
echo "Testing int val" . PHP_EOL;
@@ -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
+int_val_default_null(): Argument #1 ($a) must be of type int, null given, called in %s on line %d
Testing int with null null constant
+int_val_default_null(): Argument #1 ($a) must be of 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_constant_defaults_error.phpt b/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt
index 750edb77fa..72cc9820da 100644
--- a/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt
+++ b/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt
@@ -6,14 +6,14 @@ Scalar type - default via constants - error condition
const STRING_VAL = "test";
function int_val(int $a = STRING_VAL): int {
- return $a;
+ return $a;
}
var_dump(int_val());
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to int_val() must be of the type int, string given, called in %s on line %d and defined in %s:%d
+Fatal error: Uncaught TypeError: int_val(): Argument #1 ($a) must be of type int, string given, called in %s:%d
Stack trace:
#0 %s(%d): int_val()
#1 {main}
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/scalar_none.phpt b/Zend/tests/type_declarations/scalar_none.phpt
index a1029b830f..5b639757c0 100644
--- a/Zend/tests/type_declarations/scalar_none.phpt
+++ b/Zend/tests/type_declarations/scalar_none.phpt
@@ -23,6 +23,7 @@ foreach ($functions as $type => $function) {
}
}
echo PHP_EOL . "Done";
+?>
--EXPECTF--
Testing int:
*** Caught Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected
diff --git a/Zend/tests/type_declarations/scalar_null.phpt b/Zend/tests/type_declarations/scalar_null.phpt
index d149053fd2..d1ade3ad48 100644
--- a/Zend/tests/type_declarations/scalar_null.phpt
+++ b/Zend/tests/type_declarations/scalar_null.phpt
@@ -27,13 +27,13 @@ echo PHP_EOL . "Done";
?>
--EXPECTF--
Testing int:
-*** Caught Argument 1 passed to {closure}() must be of the type int, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
Testing float:
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
Testing string:
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
Testing bool:
-*** Caught Argument 1 passed to {closure}() must be of the type bool, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
Testing int nullable:
NULL
Testing float nullable:
diff --git a/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt b/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt
index b093983717..7f53b49b9c 100644
--- a/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt
+++ b/Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt
@@ -4,7 +4,7 @@ Scalar type - disallow relative types
<?php
function foo(bar\int $a): int {
- return $a;
+ return $a;
}
foo(10);
diff --git a/Zend/tests/type_declarations/scalar_reserved2.phpt b/Zend/tests/type_declarations/scalar_reserved2.phpt
index 893f4b542a..4e1cca3d40 100644
--- a/Zend/tests/type_declarations/scalar_reserved2.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved2.phpt
@@ -4,5 +4,6 @@ Scalar type names cannot be used as class, trait or interface names (2)
<?php
class int {}
+?>
--EXPECTF--
Fatal error: Cannot use 'int' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved2_class_alias.phpt b/Zend/tests/type_declarations/scalar_reserved2_class_alias.phpt
index 777cf9cebe..ae9e890516 100644
--- a/Zend/tests/type_declarations/scalar_reserved2_class_alias.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved2_class_alias.phpt
@@ -5,5 +5,6 @@ Scalar type names cannot be used as class, trait or interface names (2) - class_
class foobar {}
class_alias("foobar", "int");
+?>
--EXPECTF--
Fatal error: Cannot use 'int' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved2_use.phpt b/Zend/tests/type_declarations/scalar_reserved2_use.phpt
index 3e8d1be88d..63af0b11f7 100644
--- a/Zend/tests/type_declarations/scalar_reserved2_use.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved2_use.phpt
@@ -4,5 +4,6 @@ Scalar type names cannot be used as class, trait or interface names (2) - use
<?php
use foobar as int;
+?>
--EXPECTF--
Fatal error: Cannot use foobar as int because 'int' is a special class name in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved3.phpt b/Zend/tests/type_declarations/scalar_reserved3.phpt
index 433673e714..932bf624cc 100644
--- a/Zend/tests/type_declarations/scalar_reserved3.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved3.phpt
@@ -4,5 +4,6 @@ Scalar type names cannot be used as class, trait or interface names (3)
<?php
class float {}
+?>
--EXPECTF--
Fatal error: Cannot use 'float' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved3_class_alias.phpt b/Zend/tests/type_declarations/scalar_reserved3_class_alias.phpt
index dc8f319886..a7387495a3 100644
--- a/Zend/tests/type_declarations/scalar_reserved3_class_alias.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved3_class_alias.phpt
@@ -5,5 +5,6 @@ Scalar type names cannot be used as class, trait or interface names (3) - class_
class foobar {}
class_alias("foobar", "float");
+?>
--EXPECTF--
Fatal error: Cannot use 'float' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved3_use.phpt b/Zend/tests/type_declarations/scalar_reserved3_use.phpt
index af76abf498..094ac8ebec 100644
--- a/Zend/tests/type_declarations/scalar_reserved3_use.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved3_use.phpt
@@ -4,5 +4,6 @@ Scalar type names cannot be used as class, trait or interface names (3) - use
<?php
use foobar as float;
+?>
--EXPECTF--
Fatal error: Cannot use foobar as float because 'float' is a special class name in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved4.phpt b/Zend/tests/type_declarations/scalar_reserved4.phpt
index dd5ff8922e..7cd5ae5775 100644
--- a/Zend/tests/type_declarations/scalar_reserved4.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved4.phpt
@@ -4,5 +4,6 @@ Scalar type names cannot be used as class, trait or interface names (4)
<?php
class string {}
+?>
--EXPECTF--
Fatal error: Cannot use 'string' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved4_class_alias.phpt b/Zend/tests/type_declarations/scalar_reserved4_class_alias.phpt
index ebb6ac3201..311503ec61 100644
--- a/Zend/tests/type_declarations/scalar_reserved4_class_alias.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved4_class_alias.phpt
@@ -5,5 +5,6 @@ Scalar type names cannot be used as class, trait or interface names (4) - class_
class foobar {}
class_alias("foobar", "string");
+?>
--EXPECTF--
Fatal error: Cannot use 'string' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved4_use.phpt b/Zend/tests/type_declarations/scalar_reserved4_use.phpt
index e2fc0aeafe..0d068a4f61 100644
--- a/Zend/tests/type_declarations/scalar_reserved4_use.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved4_use.phpt
@@ -4,5 +4,6 @@ Scalar type names cannot be used as class, trait or interface names (4) - use
<?php
use foobar as string;
+?>
--EXPECTF--
Fatal error: Cannot use foobar as string because 'string' is a special class name in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved6.phpt b/Zend/tests/type_declarations/scalar_reserved6.phpt
index f84ec94790..dca439d212 100644
--- a/Zend/tests/type_declarations/scalar_reserved6.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved6.phpt
@@ -4,5 +4,6 @@ Scalar type names cannot be used as class, trait or interface names (6)
<?php
class bool {}
+?>
--EXPECTF--
Fatal error: Cannot use 'bool' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved6_class_alias.phpt b/Zend/tests/type_declarations/scalar_reserved6_class_alias.phpt
index 8a777eca7e..9aa060058a 100644
--- a/Zend/tests/type_declarations/scalar_reserved6_class_alias.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved6_class_alias.phpt
@@ -5,5 +5,6 @@ Scalar type names cannot be used as class, trait or interface names (6) - class_
class foobar {}
class_alias("foobar", "bool");
+?>
--EXPECTF--
Fatal error: Cannot use 'bool' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved6_use.phpt b/Zend/tests/type_declarations/scalar_reserved6_use.phpt
index e9de61ff87..a19a513b39 100644
--- a/Zend/tests/type_declarations/scalar_reserved6_use.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved6_use.phpt
@@ -4,5 +4,6 @@ Scalar type names cannot be used as class, trait or interface names (6) - use
<?php
use foobar as bool;
+?>
--EXPECTF--
Fatal error: Cannot use foobar as bool because 'bool' is a special class name in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_reserved7.phpt b/Zend/tests/type_declarations/scalar_reserved7.phpt
index 1e23d59d79..1ab7a67204 100644
--- a/Zend/tests/type_declarations/scalar_reserved7.phpt
+++ b/Zend/tests/type_declarations/scalar_reserved7.phpt
@@ -5,5 +5,6 @@ Scalar type names cannot be used as class, trait or interface names (7)
namespace foo;
class int {}
+?>
--EXPECTF--
Fatal error: Cannot use 'int' as class name as it is reserved in %s on line %d
diff --git a/Zend/tests/type_declarations/scalar_return_basic.phpt b/Zend/tests/type_declarations/scalar_return_basic.phpt
index c69196269f..deb4289f25 100644
--- a/Zend/tests/type_declarations/scalar_return_basic.phpt
+++ b/Zend/tests/type_declarations/scalar_return_basic.phpt
@@ -21,7 +21,7 @@ $functions = [
'bool' => function ($b): bool { return $b; }
];
-class Stringable {
+class StringCapable {
public function __toString() {
return "foobar";
}
@@ -42,7 +42,7 @@ $values = [
NULL,
[],
new StdClass,
- new Stringable,
+ new StringCapable,
fopen("data:text/plain,foobar", "r")
];
@@ -72,33 +72,32 @@ int(1)
*** Trying float(1.5)
int(1)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-int(1)
+*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
*** Trying string(1) "a"
-*** Caught Return value of {closure}() must be of the type int, string returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
*** Trying string(0) ""
-*** Caught Return value of {closure}() must be of the type int, string returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
*** Trying int(2147483647)
int(2147483647)
*** Trying float(NAN)
-*** Caught Return value of {closure}() must be of the type int, float returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, float returned in %s on line %d
*** Trying bool(true)
int(1)
*** Trying bool(false)
int(0)
*** Trying NULL
-*** Caught Return value of {closure}() must be of the type int, null returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught Return value of {closure}() must be of the type int, array returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, array returned in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Return value of {closure}() must be of the type int, object returned in %s on line %d
-*** Trying object(Stringable)#7 (0) {
+*** Caught {closure}(): Return value must be of type int, stdClass returned in %s on line %d
+*** Trying object(StringCapable)#7 (0) {
}
-*** Caught Return value of {closure}() must be of the type int, object returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, StringCapable returned in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Return value of {closure}() must be of the type int, resource returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, resource returned in %s on line %d
Testing 'float' type:
*** Trying int(1)
@@ -110,12 +109,11 @@ float(1)
*** Trying float(1.5)
float(1.5)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-float(1)
+*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
*** Trying string(1) "a"
-*** Caught Return value of {closure}() must be of the type float, string returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
*** Trying string(0) ""
-*** Caught Return value of {closure}() must be of the type float, string returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
*** Trying int(2147483647)
float(2147483647)
*** Trying float(NAN)
@@ -125,18 +123,18 @@ float(1)
*** Trying bool(false)
float(0)
*** Trying NULL
-*** Caught Return value of {closure}() must be of the type float, null returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught Return value of {closure}() must be of the type float, array returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, array returned in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Return value of {closure}() must be of the type float, object returned in %s on line %d
-*** Trying object(Stringable)#7 (0) {
+*** Caught {closure}(): Return value must be of type float, stdClass returned in %s on line %d
+*** Trying object(StringCapable)#7 (0) {
}
-*** Caught Return value of {closure}() must be of the type float, object returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, StringCapable returned in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Return value of {closure}() must be of the type float, resource returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, resource returned in %s on line %d
Testing 'string' type:
*** Trying int(1)
@@ -162,18 +160,18 @@ string(1) "1"
*** Trying bool(false)
string(0) ""
*** Trying NULL
-*** Caught Return value of {closure}() must be of the type string, null returned in %s on line %d
+*** Caught {closure}(): Return value must be of type string, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught Return value of {closure}() must be of the type string, array returned in %s on line %d
+*** Caught {closure}(): Return value must be of type string, array returned in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Return value of {closure}() must be of the type string, object returned in %s on line %d
-*** Trying object(Stringable)#7 (0) {
+*** Caught {closure}(): Return value must be of type string, stdClass returned in %s on line %d
+*** Trying object(StringCapable)#7 (0) {
}
string(6) "foobar"
*** Trying resource(5) of type (stream)
-*** Caught Return value of {closure}() must be of the type string, resource returned in %s on line %d
+*** Caught {closure}(): Return value must be of type string, resource returned in %s on line %d
Testing 'bool' type:
*** Trying int(1)
@@ -199,17 +197,17 @@ bool(true)
*** Trying bool(false)
bool(false)
*** Trying NULL
-*** Caught Return value of {closure}() must be of the type bool, null returned in %s on line %d
+*** Caught {closure}(): Return value must be of type bool, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught Return value of {closure}() must be of the type bool, array returned in %s on line %d
+*** Caught {closure}(): Return value must be of type bool, array returned in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Return value of {closure}() must be of the type bool, object returned in %s on line %d
-*** Trying object(Stringable)#7 (0) {
+*** Caught {closure}(): Return value must be of type bool, stdClass returned in %s on line %d
+*** Trying object(StringCapable)#7 (0) {
}
-*** Caught Return value of {closure}() must be of the type bool, object returned in %s on line %d
+*** Caught {closure}(): Return value must be of type bool, StringCapable returned in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Return value of {closure}() must be of the type bool, resource returned in %s on line %d
+*** Caught {closure}(): Return value must be of type bool, resource returned in %s on line %d
Done
diff --git a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
index 6f2ff11eb2..e49b9f5b2a 100644
--- a/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
+++ b/Zend/tests/type_declarations/scalar_return_basic_64bit.phpt
@@ -21,7 +21,7 @@ $functions = [
'bool' => function ($b): bool { return $b; }
];
-class Stringable {
+class StringCapable {
public function __toString() {
return "foobar";
}
@@ -42,7 +42,7 @@ $values = [
NULL,
[],
new StdClass,
- new Stringable,
+ new StringCapable,
fopen("data:text/plain,foobar", "r")
];
@@ -72,33 +72,32 @@ int(1)
*** Trying float(1.5)
int(1)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-int(1)
+*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
*** Trying string(1) "a"
-*** Caught Return value of {closure}() must be of the type int, string returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
*** Trying string(0) ""
-*** Caught Return value of {closure}() must be of the type int, string returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, string returned in %s on line %d
*** Trying int(9223372036854775807)
int(9223372036854775807)
*** Trying float(NAN)
-*** Caught Return value of {closure}() must be of the type int, float returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, float returned in %s on line %d
*** Trying bool(true)
int(1)
*** Trying bool(false)
int(0)
*** Trying NULL
-*** Caught Return value of {closure}() must be of the type int, null returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught Return value of {closure}() must be of the type int, array returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, array returned in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Return value of {closure}() must be of the type int, object returned in %s on line %d
-*** Trying object(Stringable)#7 (0) {
+*** Caught {closure}(): Return value must be of type int, stdClass returned in %s on line %d
+*** Trying object(StringCapable)#7 (0) {
}
-*** Caught Return value of {closure}() must be of the type int, object returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, StringCapable returned in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Return value of {closure}() must be of the type int, resource returned in %s on line %d
+*** Caught {closure}(): Return value must be of type int, resource returned in %s on line %d
Testing 'float' type:
*** Trying int(1)
@@ -110,14 +109,13 @@ float(1)
*** Trying float(1.5)
float(1.5)
*** Trying string(2) "1a"
-E_NOTICE: A non well formed numeric value encountered on line %d
-float(1)
+*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
*** Trying string(1) "a"
-*** Caught Return value of {closure}() must be of the type float, string returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
*** Trying string(0) ""
-*** Caught Return value of {closure}() must be of the type float, string returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, string returned in %s on line %d
*** Trying int(9223372036854775807)
-float(9.2233720368548E+18)
+float(9.223372036854776E+18)
*** Trying float(NAN)
float(NAN)
*** Trying bool(true)
@@ -125,18 +123,18 @@ float(1)
*** Trying bool(false)
float(0)
*** Trying NULL
-*** Caught Return value of {closure}() must be of the type float, null returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught Return value of {closure}() must be of the type float, array returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, array returned in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Return value of {closure}() must be of the type float, object returned in %s on line %d
-*** Trying object(Stringable)#7 (0) {
+*** Caught {closure}(): Return value must be of type float, stdClass returned in %s on line %d
+*** Trying object(StringCapable)#7 (0) {
}
-*** Caught Return value of {closure}() must be of the type float, object returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, StringCapable returned in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Return value of {closure}() must be of the type float, resource returned in %s on line %d
+*** Caught {closure}(): Return value must be of type float, resource returned in %s on line %d
Testing 'string' type:
*** Trying int(1)
@@ -162,18 +160,18 @@ string(1) "1"
*** Trying bool(false)
string(0) ""
*** Trying NULL
-*** Caught Return value of {closure}() must be of the type string, null returned in %s on line %d
+*** Caught {closure}(): Return value must be of type string, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught Return value of {closure}() must be of the type string, array returned in %s on line %d
+*** Caught {closure}(): Return value must be of type string, array returned in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Return value of {closure}() must be of the type string, object returned in %s on line %d
-*** Trying object(Stringable)#7 (0) {
+*** Caught {closure}(): Return value must be of type string, stdClass returned in %s on line %d
+*** Trying object(StringCapable)#7 (0) {
}
string(6) "foobar"
*** Trying resource(5) of type (stream)
-*** Caught Return value of {closure}() must be of the type string, resource returned in %s on line %d
+*** Caught {closure}(): Return value must be of type string, resource returned in %s on line %d
Testing 'bool' type:
*** Trying int(1)
@@ -199,17 +197,17 @@ bool(true)
*** Trying bool(false)
bool(false)
*** Trying NULL
-*** Caught Return value of {closure}() must be of the type bool, null returned in %s on line %d
+*** Caught {closure}(): Return value must be of type bool, null returned in %s on line %d
*** Trying array(0) {
}
-*** Caught Return value of {closure}() must be of the type bool, array returned in %s on line %d
+*** Caught {closure}(): Return value must be of type bool, array returned in %s on line %d
*** Trying object(stdClass)#6 (0) {
}
-*** Caught Return value of {closure}() must be of the type bool, object returned in %s on line %d
-*** Trying object(Stringable)#7 (0) {
+*** Caught {closure}(): Return value must be of type bool, stdClass returned in %s on line %d
+*** Trying object(StringCapable)#7 (0) {
}
-*** Caught Return value of {closure}() must be of the type bool, object returned in %s on line %d
+*** Caught {closure}(): Return value must be of type bool, StringCapable returned in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Return value of {closure}() must be of the type bool, resource returned in %s on line %d
+*** Caught {closure}(): Return value must be of type bool, resource returned in %s on line %d
Done
diff --git a/Zend/tests/type_declarations/scalar_strict.phpt b/Zend/tests/type_declarations/scalar_strict.phpt
index 78b404f9f1..6d838848e9 100644
--- a/Zend/tests/type_declarations/scalar_strict.phpt
+++ b/Zend/tests/type_declarations/scalar_strict.phpt
@@ -13,7 +13,7 @@ $functions = [
'bool' => function (bool $b) { return $b; }
];
-class Stringable {
+class StringCapable {
public function __toString() {
return "foobar";
}
@@ -34,7 +34,7 @@ $values = [
NULL,
[],
new StdClass,
- new Stringable,
+ new StringCapable,
fopen("data:text/plain,foobar", "r")
];
@@ -60,52 +60,52 @@ Testing 'int' type:
int(1)
*** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type int, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type int, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying int(2147483647)
int(2147483647)
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type int, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type int, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, bool given, called in %s on line %d
*** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type int, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, bool given, called in %s on line %d
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type int, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type int, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
*** Trying object(stdClass)#5 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#6 (0) {
+*** Trying object(StringCapable)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type int, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
Testing 'float' type:
@@ -113,7 +113,7 @@ Testing 'float' type:
float(1)
*** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying float(1)
float(1)
@@ -122,13 +122,13 @@ float(1)
float(1.5)
*** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying int(2147483647)
float(2147483647)
@@ -137,42 +137,42 @@ float(2147483647)
float(NAN)
*** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type float, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, bool given, called in %s on line %d
*** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type float, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, bool given, called in %s on line %d
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
*** Trying object(stdClass)#5 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#6 (0) {
+*** Trying object(StringCapable)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
Testing 'string' type:
*** Trying int(1)
-*** Caught Argument 1 passed to {closure}() must be of the type string, int given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
*** Trying string(1) "1"
string(1) "1"
*** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying string(2) "1a"
string(2) "1a"
@@ -184,63 +184,63 @@ string(1) "a"
string(0) ""
*** Trying int(2147483647)
-*** Caught Argument 1 passed to {closure}() must be of the type string, int given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type string, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, bool given, called in %s on line %d
*** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type string, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, bool given, called in %s on line %d
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
*** Trying object(stdClass)#5 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#6 (0) {
+*** Trying object(StringCapable)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
Testing 'bool' type:
*** Trying int(1)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, int given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
*** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type bool, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type bool, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type bool, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type bool, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying int(2147483647)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, int given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying bool(true)
bool(true)
@@ -249,21 +249,21 @@ bool(true)
bool(false)
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type bool, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type bool, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
*** Trying object(stdClass)#5 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#6 (0) {
+*** Trying object(StringCapable)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
Done
diff --git a/Zend/tests/type_declarations/scalar_strict_64bit.phpt b/Zend/tests/type_declarations/scalar_strict_64bit.phpt
index d6d38213a4..4705fa81db 100644
--- a/Zend/tests/type_declarations/scalar_strict_64bit.phpt
+++ b/Zend/tests/type_declarations/scalar_strict_64bit.phpt
@@ -13,7 +13,7 @@ $functions = [
'bool' => function (bool $b) { return $b; }
];
-class Stringable {
+class StringCapable {
public function __toString() {
return "foobar";
}
@@ -34,7 +34,7 @@ $values = [
NULL,
[],
new StdClass,
- new Stringable,
+ new StringCapable,
fopen("data:text/plain,foobar", "r")
];
@@ -60,52 +60,52 @@ Testing 'int' type:
int(1)
*** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type int, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type int, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying int(9223372036854775807)
int(9223372036854775807)
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type int, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type int, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, bool given, called in %s on line %d
*** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type int, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, bool given, called in %s on line %d
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type int, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type int, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
*** Trying object(stdClass)#5 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#6 (0) {
+*** Trying object(StringCapable)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type int, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
Testing 'float' type:
@@ -113,7 +113,7 @@ Testing 'float' type:
float(1)
*** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying float(1)
float(1)
@@ -122,57 +122,57 @@ float(1)
float(1.5)
*** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying int(9223372036854775807)
-float(9.2233720368548E+18)
+float(9.223372036854776E+18)
*** Trying float(NAN)
float(NAN)
*** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type float, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, bool given, called in %s on line %d
*** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type float, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, bool given, called in %s on line %d
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
*** Trying object(stdClass)#5 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#6 (0) {
+*** Trying object(StringCapable)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
Testing 'string' type:
*** Trying int(1)
-*** Caught Argument 1 passed to {closure}() must be of the type string, int given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
*** Trying string(1) "1"
string(1) "1"
*** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying string(2) "1a"
string(2) "1a"
@@ -184,63 +184,63 @@ string(1) "a"
string(0) ""
*** Trying int(9223372036854775807)
-*** Caught Argument 1 passed to {closure}() must be of the type string, int given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying bool(true)
-*** Caught Argument 1 passed to {closure}() must be of the type string, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, bool given, called in %s on line %d
*** Trying bool(false)
-*** Caught Argument 1 passed to {closure}() must be of the type string, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, bool given, called in %s on line %d
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
*** Trying object(stdClass)#5 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#6 (0) {
+*** Trying object(StringCapable)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
Testing 'bool' type:
*** Trying int(1)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, int given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
*** Trying string(1) "1"
-*** Caught Argument 1 passed to {closure}() must be of the type bool, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying float(1)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying float(1.5)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying string(2) "1a"
-*** Caught Argument 1 passed to {closure}() must be of the type bool, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying string(1) "a"
-*** Caught Argument 1 passed to {closure}() must be of the type bool, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying string(0) ""
-*** Caught Argument 1 passed to {closure}() must be of the type bool, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying int(9223372036854775807)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, int given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
*** Trying float(NAN)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying bool(true)
bool(true)
@@ -249,21 +249,21 @@ bool(true)
bool(false)
*** Trying NULL
-*** Caught Argument 1 passed to {closure}() must be of the type bool, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
*** Trying array(0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type bool, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
*** Trying object(stdClass)#5 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
-*** Trying object(Stringable)#6 (0) {
+*** Trying object(StringCapable)#6 (0) {
}
-*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d
*** Trying resource(5) of type (stream)
-*** Caught Argument 1 passed to {closure}() must be of the type bool, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
Done
diff --git a/Zend/tests/type_declarations/scalar_strict_basic.phpt b/Zend/tests/type_declarations/scalar_strict_basic.phpt
index 016757e671..f02649b8b5 100644
--- a/Zend/tests/type_declarations/scalar_strict_basic.phpt
+++ b/Zend/tests/type_declarations/scalar_strict_basic.phpt
@@ -57,28 +57,28 @@ Testing 'int' type:
int(1)
*** Trying float value
-*** Caught Argument 1 passed to {closure}() must be of the type int, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
*** Trying string value
-*** Caught Argument 1 passed to {closure}() must be of the type int, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
*** Trying true value
-*** Caught Argument 1 passed to {closure}() must be of the type int, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, bool given, called in %s on line %d
*** Trying false value
-*** Caught Argument 1 passed to {closure}() must be of the type int, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, bool given, called in %s on line %d
*** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type int, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, null given, called in %s on line %d
*** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type int, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
*** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type int, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
*** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type int, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
Testing 'float' type:
@@ -89,65 +89,65 @@ float(1)
float(1)
*** Trying string value
-*** Caught Argument 1 passed to {closure}() must be of the type float, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
*** Trying true value
-*** Caught Argument 1 passed to {closure}() must be of the type float, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, bool given, called in %s on line %d
*** Trying false value
-*** Caught Argument 1 passed to {closure}() must be of the type float, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, bool given, called in %s on line %d
*** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type float, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, null given, called in %s on line %d
*** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type float, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
*** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type float, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
*** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type float, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
Testing 'string' type:
*** Trying integer value
-*** Caught Argument 1 passed to {closure}() must be of the type string, int given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, int given, called in %s on line %d
*** Trying float value
-*** Caught Argument 1 passed to {closure}() must be of the type string, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, float given, called in %s on line %d
*** Trying string value
string(1) "1"
*** Trying true value
-*** Caught Argument 1 passed to {closure}() must be of the type string, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, bool given, called in %s on line %d
*** Trying false value
-*** Caught Argument 1 passed to {closure}() must be of the type string, bool given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, bool given, called in %s on line %d
*** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type string, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, null given, called in %s on line %d
*** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type string, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
*** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type string, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
*** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type string, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
Testing 'bool' type:
*** Trying integer value
-*** Caught Argument 1 passed to {closure}() must be of the type bool, int given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
*** Trying float value
-*** Caught Argument 1 passed to {closure}() must be of the type bool, float given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
*** Trying string value
-*** Caught Argument 1 passed to {closure}() must be of the type bool, string given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
*** Trying true value
bool(true)
@@ -156,15 +156,15 @@ bool(true)
bool(false)
*** Trying null value
-*** Caught Argument 1 passed to {closure}() must be of the type bool, null given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, null given, called in %s on line %d
*** Trying array value
-*** Caught Argument 1 passed to {closure}() must be of the type bool, array given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
*** Trying object value
-*** Caught Argument 1 passed to {closure}() must be of the type bool, object given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
*** Trying resource value
-*** Caught Argument 1 passed to {closure}() must be of the type bool, resource given, called in %s on line %d
+*** Caught {closure}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
Done
diff --git a/Zend/tests/type_declarations/scalar_strict_declaration_placement_004.phpt b/Zend/tests/type_declarations/scalar_strict_declaration_placement_004.phpt
index 60003241cf..3d60cf0575 100644
--- a/Zend/tests/type_declarations/scalar_strict_declaration_placement_004.phpt
+++ b/Zend/tests/type_declarations/scalar_strict_declaration_placement_004.phpt
@@ -13,5 +13,6 @@ namespace Foo {
namespace {
var_dump(Foo\add1(123));
}
+?>
--EXPECT--
int(124)
diff --git a/Zend/tests/type_declarations/scalar_strict_declaration_placement_006.phpt b/Zend/tests/type_declarations/scalar_strict_declaration_placement_006.phpt
index e0644482cb..6d731c1557 100644
--- a/Zend/tests/type_declarations/scalar_strict_declaration_placement_006.phpt
+++ b/Zend/tests/type_declarations/scalar_strict_declaration_placement_006.phpt
@@ -2,9 +2,6 @@
Test strict declaration being first operation only 006
--SKIPIF--
<?php
-if (!in_array("zend.detect_unicode", array_keys(ini_get_all()))) {
- die("skip Requires configure --enable-zend-multibyte option");
-}
if (!extension_loaded("mbstring")) {
die("skip Requires mbstring extension");
}
diff --git a/Zend/tests/type_declarations/scalar_strict_declaration_placement_007.phpt b/Zend/tests/type_declarations/scalar_strict_declaration_placement_007.phpt
index 9afef254a9..c6cfbd56f4 100644
--- a/Zend/tests/type_declarations/scalar_strict_declaration_placement_007.phpt
+++ b/Zend/tests/type_declarations/scalar_strict_declaration_placement_007.phpt
@@ -2,9 +2,6 @@
Test strict declaration being first operation only 007
--SKIPIF--
<?php
-if (!in_array("zend.detect_unicode", array_keys(ini_get_all()))) {
- die("skip Requires configure --enable-zend-multibyte option");
-}
if (!extension_loaded("mbstring")) {
die("skip Requires mbstring extension");
}
diff --git a/Zend/tests/type_declarations/scalar_strict_declaration_placement_008.phpt b/Zend/tests/type_declarations/scalar_strict_declaration_placement_008.phpt
index b5ddc9f0d3..d0b44c6b32 100644
--- a/Zend/tests/type_declarations/scalar_strict_declaration_placement_008.phpt
+++ b/Zend/tests/type_declarations/scalar_strict_declaration_placement_008.phpt
@@ -3,7 +3,7 @@ Test strict declaration block declaration 008
--FILE--
<?php
declare(strict_types=1) {
- var_dump(strlen("abc"));
+ var_dump(strlen("abc"));
}
?>
diff --git a/Zend/tests/type_declarations/static_type_in_final_class.phpt b/Zend/tests/type_declarations/static_type_in_final_class.phpt
new file mode 100644
index 0000000000..2954d7d1ac
--- /dev/null
+++ b/Zend/tests/type_declarations/static_type_in_final_class.phpt
@@ -0,0 +1,17 @@
+--TEST--
+While it may not be very useful, static is also permitted in final classes
+--FILE--
+<?php
+
+final class Test {
+ public static function create(): static {
+ return new static;
+ }
+}
+
+var_dump(Test::create());
+
+?>
+--EXPECT--
+object(Test)#1 (0) {
+}
diff --git a/Zend/tests/type_declarations/static_type_outside_class.phpt b/Zend/tests/type_declarations/static_type_outside_class.phpt
new file mode 100644
index 0000000000..f485e394b4
--- /dev/null
+++ b/Zend/tests/type_declarations/static_type_outside_class.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Static type outside class generates compile error
+--FILE--
+<?php
+
+function test(): static {}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use "static" when no class scope is active in %s on line %d
diff --git a/Zend/tests/type_declarations/static_type_param.phpt b/Zend/tests/type_declarations/static_type_param.phpt
new file mode 100644
index 0000000000..22bcda4ae7
--- /dev/null
+++ b/Zend/tests/type_declarations/static_type_param.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Static type is not allowed in parameters
+--FILE--
+<?php
+
+// TODO: We could prohibit this case in the compiler instead.
+
+class Test {
+ public function test(static $param) {
+ }
+}
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected token "static", expecting variable in %s on line %d
diff --git a/Zend/tests/type_declarations/static_type_property.phpt b/Zend/tests/type_declarations/static_type_property.phpt
new file mode 100644
index 0000000000..62bb997067
--- /dev/null
+++ b/Zend/tests/type_declarations/static_type_property.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Static type is not allowed in properties
+--FILE--
+<?php
+
+// Testing ?static here, to avoid ambiguity with static properties.
+class Test {
+ public ?static $foo;
+}
+
+?>
+--EXPECTF--
+Parse error: syntax error, unexpected token "static" in %s on line %d
diff --git a/Zend/tests/type_declarations/static_type_return.phpt b/Zend/tests/type_declarations/static_type_return.phpt
new file mode 100644
index 0000000000..820f4b0d6f
--- /dev/null
+++ b/Zend/tests/type_declarations/static_type_return.phpt
@@ -0,0 +1,91 @@
+--TEST--
+Static return type
+--FILE--
+<?php
+
+class A {
+ public function test1(): static {
+ return new static;
+ }
+ public function test2(): static {
+ return new self;
+ }
+ public function test3(): static {
+ return new static;
+ }
+ public function test4(): static|array {
+ return new self;
+ }
+}
+
+class B extends A {
+ public function test3(): static {
+ return new C;
+ }
+}
+
+class C extends B {}
+
+$a = new A;
+$b = new B;
+
+var_dump($a->test1());
+var_dump($b->test1());
+
+echo "\n";
+var_dump($a->test2());
+try {
+ var_dump($b->test2());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+echo "\n";
+var_dump($a->test3());
+var_dump($b->test3());
+
+echo "\n";
+var_dump($a->test4());
+try {
+ var_dump($b->test4());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+echo "\n";
+$test = function($x): static {
+ return $x;
+};
+
+try {
+ var_dump($test(new stdClass));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+$test = $test->bindTo($a);
+var_dump($test($a));
+
+?>
+--EXPECT--
+object(A)#3 (0) {
+}
+object(B)#3 (0) {
+}
+
+object(A)#3 (0) {
+}
+A::test2(): Return value must be of type B, A returned
+
+object(A)#3 (0) {
+}
+object(C)#3 (0) {
+}
+
+object(A)#3 (0) {
+}
+A::test4(): Return value must be of type B|array, A returned
+
+{closure}(): Return value must be of type static, stdClass returned
+object(A)#1 (0) {
+}
diff --git a/Zend/tests/type_declarations/static_type_trait.phpt b/Zend/tests/type_declarations/static_type_trait.phpt
new file mode 100644
index 0000000000..25ebe4d236
--- /dev/null
+++ b/Zend/tests/type_declarations/static_type_trait.phpt
@@ -0,0 +1,38 @@
+--TEST--
+static type in trait
+--FILE--
+<?php
+
+trait T {
+ public function test($arg): static {
+ return $arg;
+ }
+}
+
+class C {
+ use T;
+}
+class P extends C {
+}
+
+$c = new C;
+$p = new P;
+var_dump($c->test($c));
+var_dump($c->test($p));
+var_dump($p->test($p));
+var_dump($p->test($c));
+
+?>
+--EXPECTF--
+object(C)#1 (0) {
+}
+object(P)#2 (0) {
+}
+object(P)#2 (0) {
+}
+
+Fatal error: Uncaught TypeError: C::test(): Return value must be of type P, C returned in %s:%d
+Stack trace:
+#0 %s(%d): C->test(Object(C))
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/strict_call_weak.phpt b/Zend/tests/type_declarations/strict_call_weak.phpt
index d8dc93bc1e..55da67a6ef 100644
--- a/Zend/tests/type_declarations/strict_call_weak.phpt
+++ b/Zend/tests/type_declarations/strict_call_weak.phpt
@@ -13,7 +13,7 @@ require 'strict_call_weak_2.inc';
function_declared_in_weak_mode(1.0);
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to function_declared_in_weak_mode() must be of the type int, float given, called in %sstrict_call_weak.php on line 10 and defined in %sstrict_call_weak_2.inc:5
+Fatal error: Uncaught TypeError: function_declared_in_weak_mode(): Argument #1 ($x) must be of type int, float given, called in %s:%d
Stack trace:
#0 %s(%d): function_declared_in_weak_mode(1)
#1 {main}
diff --git a/Zend/tests/type_declarations/strict_call_weak_explicit.phpt b/Zend/tests/type_declarations/strict_call_weak_explicit.phpt
index e083d586e6..14b460aa9d 100644
--- a/Zend/tests/type_declarations/strict_call_weak_explicit.phpt
+++ b/Zend/tests/type_declarations/strict_call_weak_explicit.phpt
@@ -13,7 +13,7 @@ require 'strict_call_weak_explicit_2.inc';
function_declared_in_weak_mode(1.0);
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to function_declared_in_weak_mode() must be of the type int, float given, called in %sstrict_call_weak_explicit.php on line 10 and defined in %sstrict_call_weak_explicit_2.inc:5
+Fatal error: Uncaught TypeError: function_declared_in_weak_mode(): Argument #1 ($x) must be of type int, float given, called in %s:%d
Stack trace:
#0 %s(%d): function_declared_in_weak_mode(1)
#1 {main}
diff --git a/Zend/tests/type_declarations/strict_include_explicit_weak.phpt b/Zend/tests/type_declarations/strict_include_explicit_weak.phpt
index 997bdf77b4..f15636af5d 100644
--- a/Zend/tests/type_declarations/strict_include_explicit_weak.phpt
+++ b/Zend/tests/type_declarations/strict_include_explicit_weak.phpt
@@ -8,7 +8,7 @@ declare(strict_types=1);
// file that's explicitly weak
require 'strict_include_explicit_weak_2.inc';
-// calls within that file should stay weak, despite being included by strict fille
+// calls within that file should stay weak, despite being included by strict file
?>
--EXPECT--
Success!
diff --git a/Zend/tests/type_declarations/typed_properties_001.phpt b/Zend/tests/type_declarations/typed_properties_001.phpt
index 6e34cb478f..ce791cd4b5 100644
--- a/Zend/tests/type_declarations/typed_properties_001.phpt
+++ b/Zend/tests/type_declarations/typed_properties_001.phpt
@@ -3,21 +3,21 @@ Test typed properties basic operation
--FILE--
<?php
var_dump(new class(1, 2.2, true, ["four"], new stdClass) {
- public int $int;
- public float $float;
- public bool $bool;
- public array $array;
- public stdClass $std;
- public iterable $it;
+ public int $int;
+ public float $float;
+ public bool $bool;
+ public array $array;
+ public stdClass $std;
+ public iterable $it;
- public function __construct(int $int, float $float, bool $bool, array $array, stdClass $std) {
- $this->int = $int;
- $this->float = $float;
- $this->bool = $bool;
- $this->array = $array;
- $this->std = $std;
- $this->it = $array;
- }
+ public function __construct(int $int, float $float, bool $bool, array $array, stdClass $std) {
+ $this->int = $int;
+ $this->float = $float;
+ $this->bool = $bool;
+ $this->array = $array;
+ $this->std = $std;
+ $this->it = $array;
+ }
});
?>
--EXPECTF--
diff --git a/Zend/tests/type_declarations/typed_properties_002.phpt b/Zend/tests/type_declarations/typed_properties_002.phpt
index 3aec7a34ba..b0d1e1c0f2 100644
--- a/Zend/tests/type_declarations/typed_properties_002.phpt
+++ b/Zend/tests/type_declarations/typed_properties_002.phpt
@@ -3,7 +3,7 @@ Test typed properties error condition (read uninitialized)
--FILE--
<?php
$thing = new class() {
- public int $int;
+ public int $int;
};
var_dump($thing->int);
diff --git a/Zend/tests/type_declarations/typed_properties_003.phpt b/Zend/tests/type_declarations/typed_properties_003.phpt
index 59c289a566..6cde9cc604 100644
--- a/Zend/tests/type_declarations/typed_properties_003.phpt
+++ b/Zend/tests/type_declarations/typed_properties_003.phpt
@@ -3,7 +3,7 @@ Test typed properties error condition (fetch uninitialized by reference)
--FILE--
<?php
$thing = new class() {
- public int $int;
+ public int $int;
};
$var = &$thing->int;
diff --git a/Zend/tests/type_declarations/typed_properties_004.phpt b/Zend/tests/type_declarations/typed_properties_004.phpt
index 03d9e41aac..eb8e1ef6b4 100644
--- a/Zend/tests/type_declarations/typed_properties_004.phpt
+++ b/Zend/tests/type_declarations/typed_properties_004.phpt
@@ -3,16 +3,16 @@ Test typed properties error condition (type mismatch)
--FILE--
<?php
new class("PHP 7 is better than you, and it knows it ...") {
- public int $int;
+ public int $int;
- public function __construct(string $string) {
- $this->int = $string;
- }
+ public function __construct(string $string) {
+ $this->int = $string;
+ }
};
?>
--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..71f264a926 100644
--- a/Zend/tests/type_declarations/typed_properties_005.phpt
+++ b/Zend/tests/type_declarations/typed_properties_005.phpt
@@ -5,16 +5,16 @@ Test typed properties error condition (type mismatch object)
class Dummy {}
new class(new Dummy) {
- public stdClass $std;
+ public stdClass $std;
- public function __construct(Dummy $dummy) {
- $this->std = $dummy;
- }
+ public function __construct(Dummy $dummy) {
+ $this->std = $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_006.phpt b/Zend/tests/type_declarations/typed_properties_006.phpt
index c3a8faefd4..493b64fb86 100644
--- a/Zend/tests/type_declarations/typed_properties_006.phpt
+++ b/Zend/tests/type_declarations/typed_properties_006.phpt
@@ -3,11 +3,11 @@ Test typed properties inheritance (scalar)
--FILE--
<?php
class Foo {
- public int $qux;
+ public int $qux;
}
class Bar extends Foo {
- public string $qux;
+ public string $qux;
}
?>
--EXPECTF--
diff --git a/Zend/tests/type_declarations/typed_properties_007.phpt b/Zend/tests/type_declarations/typed_properties_007.phpt
index 19e8022a24..90d53b46ad 100644
--- a/Zend/tests/type_declarations/typed_properties_007.phpt
+++ b/Zend/tests/type_declarations/typed_properties_007.phpt
@@ -6,11 +6,11 @@ class Whatever {}
class Thing extends Whatever {}
class Foo {
- public Whatever $qux;
+ public Whatever $qux;
}
class Bar extends Foo {
- public Thing $qux;
+ public Thing $qux;
}
?>
--EXPECTF--
diff --git a/Zend/tests/type_declarations/typed_properties_008.phpt b/Zend/tests/type_declarations/typed_properties_008.phpt
index 70b4282626..3f82d6161d 100644
--- a/Zend/tests/type_declarations/typed_properties_008.phpt
+++ b/Zend/tests/type_declarations/typed_properties_008.phpt
@@ -3,11 +3,11 @@ Test typed properties inheritance (missing info)
--FILE--
<?php
class Foo {
- public int $qux;
+ public int $qux;
}
class Bar extends Foo {
- public $qux;
+ public $qux;
}
?>
--EXPECTF--
diff --git a/Zend/tests/type_declarations/typed_properties_009.phpt b/Zend/tests/type_declarations/typed_properties_009.phpt
index 24013b4118..668dedbbf7 100644
--- a/Zend/tests/type_declarations/typed_properties_009.phpt
+++ b/Zend/tests/type_declarations/typed_properties_009.phpt
@@ -3,13 +3,13 @@ Test typed properties unset leaves properties in an uninitialized state
--FILE--
<?php
class Foo {
- public int $bar;
+ public int $bar;
- public function __get($name) {
- var_dump($name);
- /* return value has to be compatible with int */
- return 0;
- }
+ public function __get($name) {
+ var_dump($name);
+ /* return value has to be compatible with int */
+ return 0;
+ }
}
$foo = new Foo();
diff --git a/Zend/tests/type_declarations/typed_properties_010.phpt b/Zend/tests/type_declarations/typed_properties_010.phpt
index fd7d367fea..9fcc6c96f5 100644
--- a/Zend/tests/type_declarations/typed_properties_010.phpt
+++ b/Zend/tests/type_declarations/typed_properties_010.phpt
@@ -3,11 +3,11 @@ Test typed properties allow fetch reference
--FILE--
<?php
class Foo {
- public int $bar = 1;
+ public int $bar = 1;
}
$cb = function(int &$bar) {
- var_dump($bar);
+ var_dump($bar);
};
$foo = new Foo();
diff --git a/Zend/tests/type_declarations/typed_properties_011.phpt b/Zend/tests/type_declarations/typed_properties_011.phpt
index 706a332750..f06333371f 100644
--- a/Zend/tests/type_declarations/typed_properties_011.phpt
+++ b/Zend/tests/type_declarations/typed_properties_011.phpt
@@ -3,7 +3,7 @@ Test typed properties allow fetch reference for init array
--FILE--
<?php
class Foo {
- public int $bar = 1;
+ public int $bar = 1;
}
$foo = new Foo();
diff --git a/Zend/tests/type_declarations/typed_properties_012.phpt b/Zend/tests/type_declarations/typed_properties_012.phpt
index 79a77cfa40..05fa166251 100644
--- a/Zend/tests/type_declarations/typed_properties_012.phpt
+++ b/Zend/tests/type_declarations/typed_properties_012.phpt
@@ -3,12 +3,12 @@ Test typed properties allow fetch reference for foreach
--FILE--
<?php
class Foo {
- public int $bar = 1;
+ public int $bar = 1;
}
$foo = new Foo();
foreach ($foo as &$prop) {
- $prop++;
+ $prop++;
}
var_dump($foo);
?>
diff --git a/Zend/tests/type_declarations/typed_properties_013.phpt b/Zend/tests/type_declarations/typed_properties_013.phpt
index 01c2f4b6a0..fb481d66cd 100644
--- a/Zend/tests/type_declarations/typed_properties_013.phpt
+++ b/Zend/tests/type_declarations/typed_properties_013.phpt
@@ -3,8 +3,8 @@ Test typed properties disallow incorrect type initial value (scalar)
--FILE--
<?php
class Foo {
- public int $bar = "string";
+ public int $bar = "string";
}
?>
--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..161f2e2a5a 100644
--- a/Zend/tests/type_declarations/typed_properties_014.phpt
+++ b/Zend/tests/type_declarations/typed_properties_014.phpt
@@ -3,8 +3,8 @@ Test typed properties disallow incorrect type initial value (array)
--FILE--
<?php
class Foo {
- public array $bar = 32;
+ public array $bar = 32;
}
?>
--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_015.phpt b/Zend/tests/type_declarations/typed_properties_015.phpt
index ac11c0fe3e..a40b8764b5 100644
--- a/Zend/tests/type_declarations/typed_properties_015.phpt
+++ b/Zend/tests/type_declarations/typed_properties_015.phpt
@@ -3,7 +3,7 @@ Test typed properties disallow incorrect type initial value (object)
--FILE--
<?php
class Foo {
- public stdClass $bar = null;
+ public stdClass $bar = null;
}
?>
--EXPECTF--
diff --git a/Zend/tests/type_declarations/typed_properties_016.phpt b/Zend/tests/type_declarations/typed_properties_016.phpt
index 3be4d02b7f..297ce80d9f 100644
--- a/Zend/tests/type_declarations/typed_properties_016.phpt
+++ b/Zend/tests/type_declarations/typed_properties_016.phpt
@@ -3,11 +3,11 @@ Test typed properties initial values
--FILE--
<?php
class Foo {
- public int $int = 1;
- public float $flt = 2.2;
+ public int $int = 1;
+ public float $flt = 2.2;
public float $flt2 = 2;
- public array $arr = [];
- public bool $bool = false;
+ public array $arr = [];
+ public bool $bool = false;
public iterable $iter = [];
}
var_dump(new Foo);
diff --git a/Zend/tests/type_declarations/typed_properties_017.phpt b/Zend/tests/type_declarations/typed_properties_017.phpt
index 3e501d3688..306b40f72c 100644
--- a/Zend/tests/type_declarations/typed_properties_017.phpt
+++ b/Zend/tests/type_declarations/typed_properties_017.phpt
@@ -3,7 +3,7 @@ Test typed properties disallow void
--FILE--
<?php
class Foo {
- public void $int;
+ public void $int;
}
$foo = new Foo();
diff --git a/Zend/tests/type_declarations/typed_properties_018.phpt b/Zend/tests/type_declarations/typed_properties_018.phpt
index f3ac4504b1..817ac6a84d 100644
--- a/Zend/tests/type_declarations/typed_properties_018.phpt
+++ b/Zend/tests/type_declarations/typed_properties_018.phpt
@@ -3,8 +3,8 @@ Test typed properties type applies to all props in group
--FILE--
<?php
class Foo {
- public int $bar,
- $qux;
+ public int $bar,
+ $qux;
}
$reflector = new ReflectionClass(Foo::class);
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_021.phpt b/Zend/tests/type_declarations/typed_properties_021.phpt
index 93a07771fb..d4d4d0ed19 100644
--- a/Zend/tests/type_declarations/typed_properties_021.phpt
+++ b/Zend/tests/type_declarations/typed_properties_021.phpt
@@ -3,7 +3,7 @@ Test typed properties delay type check on constant
--FILE--
<?php
class Foo {
- public int $bar = BAR::BAZ;
+ public int $bar = BAR::BAZ;
}
try {
@@ -13,4 +13,4 @@ try {
}
?>
--EXPECT--
-Class 'BAR' not found
+Class "BAR" not found
diff --git a/Zend/tests/type_declarations/typed_properties_022.phpt b/Zend/tests/type_declarations/typed_properties_022.phpt
index 7e947825c9..aeed60dcac 100644
--- a/Zend/tests/type_declarations/typed_properties_022.phpt
+++ b/Zend/tests/type_declarations/typed_properties_022.phpt
@@ -3,13 +3,13 @@ Test typed properties delay type check on ast
--FILE--
<?php
class Foo {
- public int $bar = BAR::BAZ * 2;
+ public int $bar = BAR::BAZ * 2;
}
$foo = new Foo();
?>
--EXPECTF--
-Fatal error: Uncaught Error: Class 'BAR' not found in %s:%d
+Fatal error: Uncaught Error: Class "BAR" not found in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_023.phpt b/Zend/tests/type_declarations/typed_properties_023.phpt
index 1531b23b95..3474b06732 100644
--- a/Zend/tests/type_declarations/typed_properties_023.phpt
+++ b/Zend/tests/type_declarations/typed_properties_023.phpt
@@ -3,13 +3,13 @@ Test typed static property
--FILE--
<?php
function &ref() {
- static $a = 5;
- return $a;
+ static $a = 5;
+ return $a;
}
class Foo {
- public static int $i;
- public static string $s = "x";
+ public static int $i;
+ public static string $s = "x";
}
var_dump(Foo::$i = 1);
diff --git a/Zend/tests/type_declarations/typed_properties_024.phpt b/Zend/tests/type_declarations/typed_properties_024.phpt
index 96f7216687..3f0e9fc95b 100644
--- a/Zend/tests/type_declarations/typed_properties_024.phpt
+++ b/Zend/tests/type_declarations/typed_properties_024.phpt
@@ -3,7 +3,7 @@ Test typed properties ignore private props during inheritance
--FILE--
<?php
class Foo {
- private int $thing;
+ private int $thing;
}
class Bar extends Foo {
diff --git a/Zend/tests/type_declarations/typed_properties_025.phpt b/Zend/tests/type_declarations/typed_properties_025.phpt
index 65187c1e17..5ff9d35d7b 100644
--- a/Zend/tests/type_declarations/typed_properties_025.phpt
+++ b/Zend/tests/type_declarations/typed_properties_025.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test typed properties type must preceed first declaration in group
+Test typed properties type must precede first declaration in group
--FILE--
<?php
class Foo {
@@ -8,4 +8,4 @@ class Foo {
}
?>
--EXPECTF--
-Parse error: syntax error, unexpected 'int' (T_STRING), expecting variable (T_VARIABLE) in %s on line 4
+Parse error: syntax error, unexpected identifier "int", expecting variable in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_026.phpt b/Zend/tests/type_declarations/typed_properties_026.phpt
index a2c4e25e33..7d01e927a0 100644
--- a/Zend/tests/type_declarations/typed_properties_026.phpt
+++ b/Zend/tests/type_declarations/typed_properties_026.phpt
@@ -15,6 +15,7 @@ class Baz{
}
var_dump((new Baz)->get());
+?>
--EXPECTF--
Fatal error: Uncaught Error: Typed property Baz::$baz must not be accessed before initialization in %s:10
Stack trace:
diff --git a/Zend/tests/type_declarations/typed_properties_027.phpt b/Zend/tests/type_declarations/typed_properties_027.phpt
index 861769932c..8aa291ac8e 100644
--- a/Zend/tests/type_declarations/typed_properties_027.phpt
+++ b/Zend/tests/type_declarations/typed_properties_027.phpt
@@ -4,7 +4,7 @@ Test typed properties float widen at runtime
<?php
class Foo {
- public float $bar = 1.1;
+ public float $bar = 1.1;
}
$foo = new Foo;
diff --git a/Zend/tests/type_declarations/typed_properties_028.phpt b/Zend/tests/type_declarations/typed_properties_028.phpt
index de1b3f6602..dda75b2e85 100644
--- a/Zend/tests/type_declarations/typed_properties_028.phpt
+++ b/Zend/tests/type_declarations/typed_properties_028.phpt
@@ -3,7 +3,7 @@ Test typed properties respect strict types (off)
--FILE--
<?php
class Foo {
- public int $bar;
+ public int $bar;
}
$foo = new Foo;
diff --git a/Zend/tests/type_declarations/typed_properties_029.phpt b/Zend/tests/type_declarations/typed_properties_029.phpt
index a5418c91a8..4e89d3615f 100644
--- a/Zend/tests/type_declarations/typed_properties_029.phpt
+++ b/Zend/tests/type_declarations/typed_properties_029.phpt
@@ -5,14 +5,14 @@ Test typed properties respect strict types (on)
declare(strict_types=1);
class Foo {
- public int $bar;
+ public int $bar;
}
$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..c7e641e1bf 100644
--- a/Zend/tests/type_declarations/typed_properties_030.phpt
+++ b/Zend/tests/type_declarations/typed_properties_030.phpt
@@ -3,11 +3,11 @@ Test typed properties unset __get magical magic
--FILE--
<?php
class Foo {
- public int $bar;
+ public int $bar;
- public function __get($name) {
- return "violate";
- }
+ public function __get($name) {
+ return "violate";
+ }
}
$foo = new Foo;
@@ -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_031.phpt b/Zend/tests/type_declarations/typed_properties_031.phpt
index 8022d2ef72..f714966902 100644
--- a/Zend/tests/type_declarations/typed_properties_031.phpt
+++ b/Zend/tests/type_declarations/typed_properties_031.phpt
@@ -18,5 +18,6 @@ $bar = new Bar();
$bar->setBar(100);
var_dump($bar->bar);
+?>
--EXPECT--
float(100)
diff --git a/Zend/tests/type_declarations/typed_properties_032.phpt b/Zend/tests/type_declarations/typed_properties_032.phpt
index f3ceeb5cd9..93a900dbe4 100644
--- a/Zend/tests/type_declarations/typed_properties_032.phpt
+++ b/Zend/tests/type_declarations/typed_properties_032.phpt
@@ -3,13 +3,14 @@ Test typed properties return by ref is allowed
--FILE--
<?php
$foo = new class {
- public int $bar = 15;
+ public int $bar = 15;
- public function &method() {
- return $this->bar;
- }
+ public function &method() {
+ return $this->bar;
+ }
};
var_dump($foo->method());
+?>
--EXPECT--
int(15)
diff --git a/Zend/tests/type_declarations/typed_properties_033.phpt b/Zend/tests/type_declarations/typed_properties_033.phpt
index 87e6aef26b..665026f075 100644
--- a/Zend/tests/type_declarations/typed_properties_033.phpt
+++ b/Zend/tests/type_declarations/typed_properties_033.phpt
@@ -3,23 +3,23 @@ Test typed properties yield reference guard
--FILE--
<?php
$foo = new class {
- public int $foo = 1;
- public int $bar = 3;
- public int $baz = 5;
- public int $qux = PHP_INT_MAX;
+ public int $foo = 1;
+ public int $bar = 3;
+ public int $baz = 5;
+ public int $qux = PHP_INT_MAX;
- public function &fetch() {
- yield $this->foo;
- yield $this->bar;
- yield $this->baz;
- yield $this->qux;
- }
+ public function &fetch() {
+ yield $this->foo;
+ yield $this->bar;
+ yield $this->baz;
+ yield $this->qux;
+ }
};
try {
- foreach ($foo->fetch() as &$prop) {
- $prop += 1;
- }
+ foreach ($foo->fetch() as &$prop) {
+ $prop += 1;
+ }
} catch (Error $e) { echo $e->getMessage(), "\n"; }
var_dump($foo);
diff --git a/Zend/tests/type_declarations/typed_properties_034.phpt b/Zend/tests/type_declarations/typed_properties_034.phpt
index c3885af39f..4af6baa80a 100644
--- a/Zend/tests/type_declarations/typed_properties_034.phpt
+++ b/Zend/tests/type_declarations/typed_properties_034.phpt
@@ -3,42 +3,42 @@ Test typed properties passed to typed function
--FILE--
<?php
$foo = new class {
- public ?int $bar = 42;
- public int $baz;
+ public ?int $bar = 42;
+ public int $baz;
- public function &getIterator() {
- foreach (['1', &$this->bar] as &$item) {
- yield $item;
- }
- }
+ public function &getIterator() {
+ foreach (['1', &$this->bar] as &$item) {
+ yield $item;
+ }
+ }
};
function foo(?int &$a) {
- var_dump($a);
- $a = null;
+ var_dump($a);
+ $a = null;
}
foo($foo->bar);
try {
- $foo->baz = &$foo->bar;
+ $foo->baz = &$foo->bar;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
$foo->bar = 10;
foreach ($foo->getIterator() as &$item) {
- $foo->baz = &$item;
- var_dump($foo->baz);
+ $foo->baz = &$item;
+ var_dump($foo->baz);
}
try {
- foo($foo->bar);
+ foo($foo->bar);
} catch (Error $e) { echo $e->getMessage(), "\n"; }
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_035.phpt b/Zend/tests/type_declarations/typed_properties_035.phpt
index 923f7a2a85..2fde156371 100644
--- a/Zend/tests/type_declarations/typed_properties_035.phpt
+++ b/Zend/tests/type_declarations/typed_properties_035.phpt
@@ -9,5 +9,6 @@ class Foo{
class Baz extends Foo{
public int $bar = 33;
}
+?>
--EXPECTF--
Fatal error: Type of Baz::$bar must not be defined (as in class Foo) in %s on line 8
diff --git a/Zend/tests/type_declarations/typed_properties_036.phpt b/Zend/tests/type_declarations/typed_properties_036.phpt
index edb87a38e0..df4473dff0 100644
--- a/Zend/tests/type_declarations/typed_properties_036.phpt
+++ b/Zend/tests/type_declarations/typed_properties_036.phpt
@@ -1,13 +1,13 @@
--TEST--
-Test unitialized typed properties normal foreach must not be yielded
+Test uninitialized typed properties normal foreach must not be yielded
--FILE--
<?php
$foo = new class {
- public int $bar = 10, $qux;
+ public int $bar = 10, $qux;
};
foreach ($foo as $key => $bar) {
- var_dump($key, $bar);
+ var_dump($key, $bar);
}
?>
--EXPECT--
diff --git a/Zend/tests/type_declarations/typed_properties_037.phpt b/Zend/tests/type_declarations/typed_properties_037.phpt
index c5dde53572..87efa3317a 100644
--- a/Zend/tests/type_declarations/typed_properties_037.phpt
+++ b/Zend/tests/type_declarations/typed_properties_037.phpt
@@ -3,10 +3,11 @@ Test typed properties var_dump uninitialized
--FILE--
<?php
$foo = new class {
- public int $bar = 10, $qux;
+ public int $bar = 10, $qux;
};
var_dump($foo);
+?>
--EXPECTF--
object(class@anonymous)#%d (1) {
["bar"]=>
diff --git a/Zend/tests/type_declarations/typed_properties_038.phpt b/Zend/tests/type_declarations/typed_properties_038.phpt
index 44e5d04c7f..4bb5b75a28 100644
--- a/Zend/tests/type_declarations/typed_properties_038.phpt
+++ b/Zend/tests/type_declarations/typed_properties_038.phpt
@@ -4,47 +4,48 @@ Test typed properties overflowing
<?php
$foo = new class {
- public int $bar = PHP_INT_MAX;
+ public int $bar = PHP_INT_MAX;
};
try {
- $foo->bar++;
+ $foo->bar++;
} catch(TypeError $t) {
- var_dump($t->getMessage());
+ var_dump($t->getMessage());
}
var_dump($foo);
try {
- $foo->bar += 1;
+ $foo->bar += 1;
} catch(TypeError $t) {
- var_dump($t->getMessage());
+ var_dump($t->getMessage());
}
var_dump($foo);
try {
- ++$foo->bar;
+ ++$foo->bar;
} catch(TypeError $t) {
- var_dump($t->getMessage());
+ var_dump($t->getMessage());
}
var_dump($foo);
try {
- $foo->bar = $foo->bar + 1;
+ $foo->bar = $foo->bar + 1;
} catch(TypeError $t) {
- var_dump($t->getMessage());
+ var_dump($t->getMessage());
}
var_dump($foo);
+?>
--EXPECTF--
string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value"
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 +55,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 4da738cb41..7a77c4cc0f 100644
--- a/Zend/tests/type_declarations/typed_properties_040.phpt
+++ b/Zend/tests/type_declarations/typed_properties_040.phpt
@@ -5,11 +5,11 @@ Test __get on unset typed property must fail properly
declare(strict_types=1);
class Foo {
- public int $bar;
+ public int $bar;
- public function __get($name) {
- var_dump($name);
- }
+ public function __get($name) {
+ var_dump($name);
+ }
}
$foo = new Foo();
@@ -20,7 +20,7 @@ var_dump($foo->bar);
--EXPECTF--
string(3) "bar"
-Fatal error: Uncaught TypeError: Typed property Foo::$bar must be int, null used in %s:%d
+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 %d
diff --git a/Zend/tests/type_declarations/typed_properties_041.phpt b/Zend/tests/type_declarations/typed_properties_041.phpt
index 76dbfd8f5d..1c5ab0bad5 100644
--- a/Zend/tests/type_declarations/typed_properties_041.phpt
+++ b/Zend/tests/type_declarations/typed_properties_041.phpt
@@ -4,7 +4,7 @@ Test typed properties weak conversion of strings
<?php
class Foo {
- public int $bar = 1;
+ public int $bar = 1;
}
$foo = new Foo;
diff --git a/Zend/tests/type_declarations/typed_properties_042.phpt b/Zend/tests/type_declarations/typed_properties_042.phpt
index ecb3df3c11..845395f8ba 100644
--- a/Zend/tests/type_declarations/typed_properties_042.phpt
+++ b/Zend/tests/type_declarations/typed_properties_042.phpt
@@ -3,14 +3,14 @@ Proper source duplication on assignment to typed property
--FILE--
<?php
class Foo {
- public int $bar;
+ public int $bar;
}
$foo = new Foo();
for ($i = 0; $i < 5; $i++) {
- $foo->bar = "5";
- var_dump($foo->bar);
+ $foo->bar = "5";
+ var_dump($foo->bar);
}
?>
--EXPECT--
diff --git a/Zend/tests/type_declarations/typed_properties_043.phpt b/Zend/tests/type_declarations/typed_properties_043.phpt
index eefe358796..79f01545e1 100644
--- a/Zend/tests/type_declarations/typed_properties_043.phpt
+++ b/Zend/tests/type_declarations/typed_properties_043.phpt
@@ -41,9 +41,9 @@ var_dump(Bar::$selfProp, Bar::$selfNullProp, Bar::$parentProp);
?>
--EXPECT--
-Cannot write a value to a 'self' typed static property of a trait
-Cannot write a non-null value to a 'self' typed static property of a trait
-Cannot access parent:: when current class scope has no parent
+Cannot assign stdClass to property Test::$selfProp of type self
+Cannot assign stdClass to property Test::$selfNullProp of type ?self
+Cannot assign stdClass to property Test::$parentProp of type parent
NULL
object(Bar)#3 (0) {
}
diff --git a/Zend/tests/type_declarations/typed_properties_044.phpt b/Zend/tests/type_declarations/typed_properties_044.phpt
index 02a71a7b0b..f32cd92844 100644
--- a/Zend/tests/type_declarations/typed_properties_044.phpt
+++ b/Zend/tests/type_declarations/typed_properties_044.phpt
@@ -5,7 +5,7 @@ Test increment functions on typed property references
--FILE--
<?php
$foo = new class {
- public ?int $bar;
+ public ?int $bar;
};
$bar = &$foo->bar;
@@ -20,30 +20,30 @@ var_dump($bar++);
$bar = PHP_INT_MAX;
try {
- var_dump($bar++);
+ var_dump($bar++);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(++$bar);
+ var_dump(++$bar);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$bar = PHP_INT_MIN;
try {
- var_dump($bar--);
+ var_dump($bar--);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(--$bar);
+ var_dump(--$bar);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
diff --git a/Zend/tests/type_declarations/typed_properties_046.phpt b/Zend/tests/type_declarations/typed_properties_046.phpt
index 050e64a2a4..2048455fe5 100644
--- a/Zend/tests/type_declarations/typed_properties_046.phpt
+++ b/Zend/tests/type_declarations/typed_properties_046.phpt
@@ -3,27 +3,28 @@ Memory leaks on wrong assignment to typed property
--FILE--
<?php
class Foo {
- public int $bbb;
+ public int $bbb;
}
function foo() {
- return new Foo();
+ return new Foo();
}
function bar() {
- return str_repeat("b", 3);
+ return str_repeat("b", 3);
}
for ($i = 0; $i < 5; $i++) {
- try {
- foo()->{bar()} = str_repeat("a", 3);
- } catch (Throwable $e) {
- echo $e->getMessage() . "\n";
- }
+ try {
+ foo()->{bar()} = str_repeat("a", 3);
+ } catch (Throwable $e) {
+ echo $e->getMessage() . "\n";
+ }
}
+?>
--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..5de7b254d9 100644
--- a/Zend/tests/type_declarations/typed_properties_047.phpt
+++ b/Zend/tests/type_declarations/typed_properties_047.phpt
@@ -3,7 +3,7 @@ Nullable typed property
--FILE--
<?php
class Foo {
- public ?int $foo = null;
+ public ?int $foo = null;
}
$x = new Foo();
@@ -18,14 +18,14 @@ var_dump($x->foo);
unset($x->foo);
try {
- var_dump($x->foo);
+ var_dump($x->foo);
} catch (Throwable $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
try {
- $x->foo = "ops";
+ $x->foo = "ops";
} catch (Throwable $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
--EXPECT--
@@ -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_048.phpt b/Zend/tests/type_declarations/typed_properties_048.phpt
index 8a06c55f23..e432c1afff 100644
--- a/Zend/tests/type_declarations/typed_properties_048.phpt
+++ b/Zend/tests/type_declarations/typed_properties_048.phpt
@@ -4,10 +4,10 @@ Parent private property types must be ignored
<?php
class A {
- private $prop = "1";
+ private $prop = "1";
}
class B extends A {
- private int $prop = 2;
+ private int $prop = 2;
}
var_dump((function () { return $this->prop; })->call(new B));
diff --git a/Zend/tests/type_declarations/typed_properties_049.phpt b/Zend/tests/type_declarations/typed_properties_049.phpt
index e761590548..ed4f07e4b6 100644
--- a/Zend/tests/type_declarations/typed_properties_049.phpt
+++ b/Zend/tests/type_declarations/typed_properties_049.phpt
@@ -3,7 +3,7 @@ Nullable typed property
--FILE--
<?php
class Foo {
- public int $foo = null;
+ public int $foo = null;
}
?>
--EXPECTF--
diff --git a/Zend/tests/type_declarations/typed_properties_051.phpt b/Zend/tests/type_declarations/typed_properties_051.phpt
index 1c8673d0d3..37972c967b 100644
--- a/Zend/tests/type_declarations/typed_properties_051.phpt
+++ b/Zend/tests/type_declarations/typed_properties_051.phpt
@@ -4,12 +4,12 @@ Weak casts must not leak
<?php
class A {
- public string $a;
+ public string $a;
}
class B {
- function __toString() {
- return str_repeat("ok", 2);
- }
+ function __toString() {
+ return str_repeat("ok", 2);
+ }
}
class C {
}
@@ -17,11 +17,11 @@ $o = new A;
$o->a = new B;
var_dump($o->a);
try {
- $o->a = new C;
+ $o->a = new C;
} catch (Throwable $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
--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_052.phpt b/Zend/tests/type_declarations/typed_properties_052.phpt
index 3a73d7359a..cf6a6b05a1 100644
--- a/Zend/tests/type_declarations/typed_properties_052.phpt
+++ b/Zend/tests/type_declarations/typed_properties_052.phpt
@@ -5,12 +5,12 @@ Class properties declared in eval() must not leak
eval(<<<'EOF'
class A {
- public A $a1;
- public \B $b1;
- public Foo\C $c1;
- public ?A $a2;
- public ?\B $b2;
- public ?Foo\C $c2;
+ public A $a1;
+ public \B $b1;
+ public Foo\C $c1;
+ public ?A $a2;
+ public ?\B $b2;
+ public ?Foo\C $c2;
}
EOF
);
diff --git a/Zend/tests/type_declarations/typed_properties_053.phpt b/Zend/tests/type_declarations/typed_properties_053.phpt
index 1da42bcbd9..3b347795b3 100644
--- a/Zend/tests/type_declarations/typed_properties_053.phpt
+++ b/Zend/tests/type_declarations/typed_properties_053.phpt
@@ -3,7 +3,7 @@ Typed properties disallow callable
--FILE--
<?php
class A {
- public callable $a;
+ public callable $a;
}
$obj = new A;
var_dump($obj);
diff --git a/Zend/tests/type_declarations/typed_properties_054.phpt b/Zend/tests/type_declarations/typed_properties_054.phpt
index 38de9815ed..281d59f26c 100644
--- a/Zend/tests/type_declarations/typed_properties_054.phpt
+++ b/Zend/tests/type_declarations/typed_properties_054.phpt
@@ -3,10 +3,10 @@ Typed properties disallow callable (nullable variant)
--FILE--
<?php
class A {
- public ?callable $a;
+ public ?callable $a;
}
$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_055.phpt b/Zend/tests/type_declarations/typed_properties_055.phpt
index 31d687254c..36afb48a51 100644
--- a/Zend/tests/type_declarations/typed_properties_055.phpt
+++ b/Zend/tests/type_declarations/typed_properties_055.phpt
@@ -3,15 +3,15 @@ Test assign to typed property taken by reference
--FILE--
<?php
class A {
- public $foo = 1;
- public int $bar = 2;
+ public $foo = 1;
+ public int $bar = 2;
}
class B {
- public A $a;
+ public A $a;
}
$f = function (&$n) {
- var_dump($n);
- $n = "ops";
+ var_dump($n);
+ $n = "ops";
};
$o = new B;
$o->a = new A;
diff --git a/Zend/tests/type_declarations/typed_properties_056.phpt b/Zend/tests/type_declarations/typed_properties_056.phpt
index 54013f44f2..868594b38a 100644
--- a/Zend/tests/type_declarations/typed_properties_056.phpt
+++ b/Zend/tests/type_declarations/typed_properties_056.phpt
@@ -5,19 +5,19 @@ Type change in assign_op (use-after-free)
declare(strict_types=1);
class A {
- public string $foo;
+ public string $foo;
}
$o = new A;
$o->foo = "1" . str_repeat("0", 2);
try {
- $o->foo += 5;
+ $o->foo += 5;
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
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..eb565f0c36 100644
--- a/Zend/tests/type_declarations/typed_properties_057.phpt
+++ b/Zend/tests/type_declarations/typed_properties_057.phpt
@@ -5,15 +5,15 @@ Type change in pre/post-increment (use-after-free)
declare(strict_types=1);
class A {
- public string $foo;
+ public string $foo;
}
$o = new A;
$o->foo = "1" . str_repeat("0", 2);
try {
- $x = ++$o->foo;
+ $x = ++$o->foo;
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
var_dump($o->foo);
try {
@@ -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..47c75037d1 100644
--- a/Zend/tests/type_declarations/typed_properties_058.phpt
+++ b/Zend/tests/type_declarations/typed_properties_058.phpt
@@ -7,26 +7,26 @@ declare(strict_types=1);
define("FOO", 5);
class A {
- public int $foo = FOO;
+ public int $foo = FOO;
}
class B {
- public string $foo = FOO;
+ public string $foo = FOO;
}
$o = new A();
var_dump($o->foo);
for ($i = 0; $i < 2; $i++) {
- try {
- $o = new B();
- var_dump($o->foo);
- } catch (Throwable $e) {
- echo $e->getMessage() . "\n";
- }
+ try {
+ $o = new B();
+ var_dump($o->foo);
+ } catch (Throwable $e) {
+ echo $e->getMessage() . "\n";
+ }
}
?>
--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_059.phpt b/Zend/tests/type_declarations/typed_properties_059.phpt
index caee8501f7..59aaacce60 100644
--- a/Zend/tests/type_declarations/typed_properties_059.phpt
+++ b/Zend/tests/type_declarations/typed_properties_059.phpt
@@ -3,14 +3,14 @@ Nullable typed properties in traits
--FILE--
<?php
trait T {
- public int $a1;
- public ?int $b1;
+ public int $a1;
+ public ?int $b1;
}
class A {
- use T;
- public int $a2;
- public ?int $b2;
+ use T;
+ public int $a2;
+ public ?int $b2;
}
$x = new A;
diff --git a/Zend/tests/type_declarations/typed_properties_060.phpt b/Zend/tests/type_declarations/typed_properties_060.phpt
index 559349b7a9..bf02c31251 100644
--- a/Zend/tests/type_declarations/typed_properties_060.phpt
+++ b/Zend/tests/type_declarations/typed_properties_060.phpt
@@ -4,7 +4,7 @@ Test typed properties work fine with simple inheritance
<?php
class A {
- public int $a = 1;
+ public int $a = 1;
}
class B extends A {}
@@ -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_061.phpt b/Zend/tests/type_declarations/typed_properties_061.phpt
index 647543c6d6..b946b2d259 100644
--- a/Zend/tests/type_declarations/typed_properties_061.phpt
+++ b/Zend/tests/type_declarations/typed_properties_061.phpt
@@ -6,15 +6,15 @@ Typed property on overloaded by-ref property
<?php
$a = new class {
- public int $foo = 1;
+ public int $foo = 1;
- function &__get($x) {
- return $this->foo;
- }
+ function &__get($x) {
+ return $this->foo;
+ }
- function __set($x, $y) {
- echo "set($y)\n";
- }
+ function __set($x, $y) {
+ echo "set($y)\n";
+ }
};
$a->_ += 1;
diff --git a/Zend/tests/type_declarations/typed_properties_062.phpt b/Zend/tests/type_declarations/typed_properties_062.phpt
index 45f4682806..6e1242e990 100644
--- a/Zend/tests/type_declarations/typed_properties_062.phpt
+++ b/Zend/tests/type_declarations/typed_properties_062.phpt
@@ -4,8 +4,8 @@ Typed property on by-ref property
<?php
$a = new class {
- public int $foo = 1;
- public $_;
+ public int $foo = 1;
+ public $_;
};
$a->_ = &$a->foo;
@@ -17,7 +17,7 @@ $a->_ .= "1";
var_dump($a->foo);
try {
- $a->_ .= "e50";
+ $a->_ .= "e50";
} catch (Error $e) { echo $e->getMessage(), "\n"; }
var_dump($a->foo);
@@ -30,30 +30,30 @@ var_dump($a->foo);
$a->foo = PHP_INT_MIN;
try {
- $a->_--;
+ $a->_--;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
- --$a->_;
+ --$a->_;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$a->foo = PHP_INT_MAX;
try {
- $a->_++;
+ $a->_++;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
- ++$a->_;
+ ++$a->_;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$a->_ = 0;
try {
- $a->_ = [];
+ $a->_ = [];
} catch (Error $e) { echo $e->getMessage(), "\n"; }
var_dump($a->foo);
diff --git a/Zend/tests/type_declarations/typed_properties_063.phpt b/Zend/tests/type_declarations/typed_properties_063.phpt
index bd4cccff22..b67e95c24b 100644
--- a/Zend/tests/type_declarations/typed_properties_063.phpt
+++ b/Zend/tests/type_declarations/typed_properties_063.phpt
@@ -4,7 +4,7 @@ Typed property on by-ref variable
<?php
$a = new class {
- public int $foo = 1;
+ public int $foo = 1;
};
$_ = &$a->foo;
@@ -16,7 +16,7 @@ $_ .= "1";
var_dump($a->foo);
try {
- $_ .= "e50";
+ $_ .= "e50";
} catch (Error $e) { echo $e->getMessage(), "\n"; }
var_dump($a->foo);
@@ -29,30 +29,30 @@ var_dump($a->foo);
$a->foo = PHP_INT_MIN;
try {
- $_--;
+ $_--;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
- --$_;
+ --$_;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$a->foo = PHP_INT_MAX;
try {
- $_++;
+ $_++;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
- ++$_;
+ ++$_;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$_ = 0;
try {
- $_ = [];
+ $_ = [];
} catch (Error $e) { echo $e->getMessage(), "\n"; }
var_dump($a->foo);
diff --git a/Zend/tests/type_declarations/typed_properties_064.phpt b/Zend/tests/type_declarations/typed_properties_064.phpt
index 59e0552898..dd7b5517a7 100644
--- a/Zend/tests/type_declarations/typed_properties_064.phpt
+++ b/Zend/tests/type_declarations/typed_properties_064.phpt
@@ -4,7 +4,7 @@ Typed property on by-ref array value
<?php
$a = new class {
- public int $foo = 1;
+ public int $foo = 1;
};
$_ = [&$a->foo];
@@ -16,7 +16,7 @@ $_[0] .= "1";
var_dump($a->foo);
try {
- $_[0] .= "e50";
+ $_[0] .= "e50";
} catch (Error $e) { echo $e->getMessage(), "\n"; }
var_dump($a->foo);
@@ -34,25 +34,25 @@ try {
echo gettype($a->foo),"\n";
try {
- --$_[0];
+ --$_[0];
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$a->foo = PHP_INT_MAX;
try {
- $_[0]++;
+ $_[0]++;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
- ++$_[0];
+ ++$_[0];
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$_[0] = 0;
try {
- $_[0] = [];
+ $_[0] = [];
} catch (Error $e) { echo $e->getMessage(), "\n"; }
var_dump($a->foo);
diff --git a/Zend/tests/type_declarations/typed_properties_065.phpt b/Zend/tests/type_declarations/typed_properties_065.phpt
index da88cbf2cb..7a1dd54894 100644
--- a/Zend/tests/type_declarations/typed_properties_065.phpt
+++ b/Zend/tests/type_declarations/typed_properties_065.phpt
@@ -4,12 +4,12 @@ Typed property on by-ref array dimension
<?php
$a = new class implements ArrayAccess {
- public int $foo = 1;
+ public int $foo = 1;
- function offsetExists($o) { return 1; }
- function &offsetGet($o) { return $this->foo; }
- function offsetSet($o, $v) { print "offsetSet($v)\n"; }
- function offsetUnset($o) { print "offsetUnset() ?!?"; }
+ function offsetExists($o) { return 1; }
+ function &offsetGet($o) { return $this->foo; }
+ function offsetSet($o, $v) { print "offsetSet($v)\n"; }
+ function offsetUnset($o) { print "offsetUnset() ?!?"; }
};
$a[0] += 1;
@@ -35,19 +35,19 @@ try {
echo gettype($a->foo),"\n";
try {
- --$a[0];
+ --$a[0];
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
$a->foo = PHP_INT_MAX;
try {
- $a[0]++;
+ $a[0]++;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
try {
- ++$a[0];
+ ++$a[0];
} catch (Error $e) { echo $e->getMessage(), "\n"; }
echo gettype($a->foo),"\n";
@@ -61,11 +61,11 @@ offsetSet(1e50)
int(1)
int(0)
int(-1)
-Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
+Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value
integer
-Cannot decrement a reference held by property class@anonymous::$foo of type int past its minimal value
+Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value
integer
-Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
+Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value
integer
-Cannot increment a reference held by property class@anonymous::$foo of type int past its maximal value
+Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value
integer
diff --git a/Zend/tests/type_declarations/typed_properties_066.phpt b/Zend/tests/type_declarations/typed_properties_066.phpt
index a91a00df65..7dc217d2e4 100644
--- a/Zend/tests/type_declarations/typed_properties_066.phpt
+++ b/Zend/tests/type_declarations/typed_properties_066.phpt
@@ -4,7 +4,7 @@ Typed property assignment must not overwrite constants
<?php
class Foo {
- public float $x = 0.0;
+ public float $x = 0.0;
};
$x = new Foo;
diff --git a/Zend/tests/type_declarations/typed_properties_067.phpt b/Zend/tests/type_declarations/typed_properties_067.phpt
index da6865e5d4..cfbc068db1 100644
--- a/Zend/tests/type_declarations/typed_properties_067.phpt
+++ b/Zend/tests/type_declarations/typed_properties_067.phpt
@@ -4,11 +4,11 @@ Iterable typed properties must be accepted to by-ref array arguments
<?php
$obj = new class {
- public ?iterable $it = null;
+ public ?iterable $it = null;
};
function arr(?array &$arr) {
- $arr = [1];
+ $arr = [1];
}
arr($obj->it);
diff --git a/Zend/tests/type_declarations/typed_properties_068.phpt b/Zend/tests/type_declarations/typed_properties_068.phpt
index 7ed58d2a00..38597559cf 100644
--- a/Zend/tests/type_declarations/typed_properties_068.phpt
+++ b/Zend/tests/type_declarations/typed_properties_068.phpt
@@ -3,14 +3,14 @@ Test typed static property by ref
--FILE--
<?php
function &ref($a = null) {
- static $f;
- if ($a !== null) $f = function &() use (&$a) { return $a; };
- return $f();
+ static $f;
+ if ($a !== null) $f = function &() use (&$a) { return $a; };
+ return $f();
}
class Foo {
- public static int $i;
- public static string $s = "x";
+ public static int $i;
+ public static string $s = "x";
}
Foo::$i = &ref(5);
@@ -27,12 +27,12 @@ Foo::$i = "4";
var_dump($i, Foo::$i);
try {
- $i = null;
+ $i = null;
} catch (TypeError $e) { print $e->getMessage()."\n"; }
var_dump($i, Foo::$i);
try {
- Foo::$i = null;
+ Foo::$i = null;
} catch (TypeError $e) { print $e->getMessage()."\n"; }
var_dump($i, Foo::$i);
@@ -43,17 +43,17 @@ Foo::$i = &ref("0");
var_dump(Foo::$i, ref());
try {
- Foo::$i = &ref("x");
+ Foo::$i = &ref("x");
} catch (TypeError $e) { print $e->getMessage()."\n"; }
var_dump(Foo::$i, ref());
try {
- Foo::$i = &Foo::$s;
+ Foo::$i = &Foo::$s;
} catch (TypeError $e) { print $e->getMessage()."\n"; }
var_dump(Foo::$i, Foo::$s);
try {
- Foo::$s = &Foo::$i;
+ Foo::$s = &Foo::$i;
} catch (TypeError $e) { print $e->getMessage()."\n"; }
var_dump(Foo::$i, Foo::$s);
@@ -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..7d84407102 100644
--- a/Zend/tests/type_declarations/typed_properties_069.phpt
+++ b/Zend/tests/type_declarations/typed_properties_069.phpt
@@ -4,24 +4,24 @@ Test assign of invalid string to typed static int property
<?php
function &nonNumericStringRef() {
- static $a = "x";
- return $a;
+ static $a = "x";
+ return $a;
}
class Foo {
- public static int $i;
+ public static int $i;
}
try {
- Foo::$i = &nonNumericStringRef();
+ Foo::$i = &nonNumericStringRef();
} catch (TypeError $e) { print $e->getMessage()."\n"; }
try {
- var_dump(Foo::$i);
+ var_dump(Foo::$i);
} catch (Error $e) { print $e->getMessage()."\n"; }
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..d039fca3b1 100644
--- a/Zend/tests/type_declarations/typed_properties_070.phpt
+++ b/Zend/tests/type_declarations/typed_properties_070.phpt
@@ -3,15 +3,15 @@ Test typed static property with assign op operators
--FILE--
<?php
function &stringRef() {
- static $a = "1";
- $b = $a;
- $a = &$b;
- return $a;
+ static $a = "1";
+ $b = $a;
+ $a = &$b;
+ return $a;
}
class Foo {
- public static int $i = 0;
- public static string $s = "1";
+ public static int $i = 0;
+ public static string $s = "1";
}
Foo::$s .= "1";
@@ -28,12 +28,12 @@ Foo::$i += stringRef();
var_dump(Foo::$i);
try {
- Foo::$i += PHP_INT_MAX;
+ Foo::$i += PHP_INT_MAX;
} catch (TypeError $e) { print $e->getMessage()."\n"; }
var_dump(Foo::$i);
try {
- Foo::$i .= PHP_INT_MAX;
+ Foo::$i .= PHP_INT_MAX;
} catch (TypeError $e) { print $e->getMessage()."\n"; }
var_dump(Foo::$i);
@@ -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_071.phpt b/Zend/tests/type_declarations/typed_properties_071.phpt
index 4d0451cf73..d45abcd4ca 100644
--- a/Zend/tests/type_declarations/typed_properties_071.phpt
+++ b/Zend/tests/type_declarations/typed_properties_071.phpt
@@ -2,7 +2,7 @@
Test assignment to typed reference with weak type conversion
--FILE--
<?php
-
+
class Test {
public string $x = "x";
}
diff --git a/Zend/tests/type_declarations/typed_properties_072.phpt b/Zend/tests/type_declarations/typed_properties_072.phpt
index 13fab7177e..99a475767f 100644
--- a/Zend/tests/type_declarations/typed_properties_072.phpt
+++ b/Zend/tests/type_declarations/typed_properties_072.phpt
@@ -2,13 +2,13 @@
Typed property must cast when used with __get()
--FILE--
<?php
-
+
class Test {
- public int $val;
+ public int $val;
- public function __get($name) {
- return "42";
- }
+ public function __get($name) {
+ return "42";
+ }
}
$test = new Test;
diff --git a/Zend/tests/type_declarations/typed_properties_073.phpt b/Zend/tests/type_declarations/typed_properties_073.phpt
index 43cb0f507b..b0fa9e4e2b 100644
--- a/Zend/tests/type_declarations/typed_properties_073.phpt
+++ b/Zend/tests/type_declarations/typed_properties_073.phpt
@@ -2,14 +2,14 @@
Typed property must cast when used with &__get()
--FILE--
<?php
-
+
class Test {
- public $prop = "42";
- public int $val;
+ public $prop = "42";
+ public int $val;
- public function &__get($name) {
- return $this->prop;
- }
+ public function &__get($name) {
+ return $this->prop;
+ }
}
$test = new Test;
diff --git a/Zend/tests/type_declarations/typed_properties_074.phpt b/Zend/tests/type_declarations/typed_properties_074.phpt
index dd2fb5f521..f13398d9d7 100644
--- a/Zend/tests/type_declarations/typed_properties_074.phpt
+++ b/Zend/tests/type_declarations/typed_properties_074.phpt
@@ -2,14 +2,14 @@
Typed property must be compatible when returned via &__get()
--FILE--
<?php
-
+
class Test {
- public $prop = "x";
- public int $val;
+ public $prop = "x";
+ public int $val;
- public function &__get($name) {
- return $this->prop;
- }
+ public function &__get($name) {
+ return $this->prop;
+ }
}
$test = new Test;
@@ -17,7 +17,7 @@ $dummyRef = &$test->prop;
unset($test->val);
var_dump($test);
try {
- var_dump($test->val);
+ var_dump($test->val);
} catch (TypeError $e) { print $e->getMessage()."\n"; }
var_dump($test);
@@ -32,7 +32,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..42e74ebce4 100644
--- a/Zend/tests/type_declarations/typed_properties_075.phpt
+++ b/Zend/tests/type_declarations/typed_properties_075.phpt
@@ -6,37 +6,37 @@ Test typed properties overflowing
<?php
class Foo {
- public static int $bar = PHP_INT_MAX;
+ public static int $bar = PHP_INT_MAX;
};
try {
- Foo::$bar++;
+ Foo::$bar++;
} catch(TypeError $t) {
- var_dump($t->getMessage());
+ var_dump($t->getMessage());
}
var_dump(Foo::$bar);
try {
- Foo::$bar += 1;
+ Foo::$bar += 1;
} catch(TypeError $t) {
- var_dump($t->getMessage());
+ var_dump($t->getMessage());
}
var_dump(Foo::$bar);
try {
- ++Foo::$bar;
+ ++Foo::$bar;
} catch(TypeError $t) {
- var_dump($t->getMessage());
+ var_dump($t->getMessage());
}
var_dump(Foo::$bar);
try {
- Foo::$bar = Foo::$bar + 1;
+ Foo::$bar = Foo::$bar + 1;
} catch(TypeError $t) {
- var_dump($t->getMessage());
+ var_dump($t->getMessage());
}
var_dump(Foo::$bar);
@@ -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..07e9384b6f 100644
--- a/Zend/tests/type_declarations/typed_properties_078.phpt
+++ b/Zend/tests/type_declarations/typed_properties_078.phpt
@@ -1,12 +1,12 @@
--TEST--
-Typed references must be kept track of and always be only the intersection of the types currently holding that reference
+Typed references must be kept track of and always be only the intersection of the type currently holding that reference
--FILE--
<?php
$a = new class {
- public ?iterable $it = [];
- public ?array $a;
- public ?Traversable $t;
+ public ?iterable $it = [];
+ public ?array $a;
+ public ?Traversable $t;
};
$ref = &$a->it;
@@ -15,7 +15,7 @@ $a->a = &$ref;
var_dump($ref);
try {
- $a->t = &$ref;
+ $a->t = &$ref;
} catch (TypeError $e) { var_dump($e->getMessage()); }
var_dump($ref);
@@ -23,7 +23,7 @@ $a->it = [1]; // type is still assignable
var_dump($ref);
try {
- $ref = new ArrayIterator();
+ $ref = new ArrayIterator();
} catch (TypeError $e) { var_dump($e->getMessage()); }
var_dump($ref instanceof ArrayIterator);
@@ -34,7 +34,7 @@ $ref = null;
$a->t = &$ref;
try {
- $ref = [];
+ $ref = [];
} catch (TypeError $e) { var_dump($e->getMessage()); }
var_dump($ref instanceof ArrayIterator);
@@ -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_079.phpt b/Zend/tests/type_declarations/typed_properties_079.phpt
index 85ed6fc75d..d189cec6d4 100644
--- a/Zend/tests/type_declarations/typed_properties_079.phpt
+++ b/Zend/tests/type_declarations/typed_properties_079.phpt
@@ -4,14 +4,14 @@ Test static typed properties with references
<?php
class A {
- static iterable $it = [];
- static ?array $a;
+ static iterable $it = [];
+ static ?array $a;
}
A::$a = &A::$it;
try {
- A::$it = new ArrayIterator();
+ A::$it = new ArrayIterator();
} catch (TypeError $e) { var_dump($e->getMessage()); }
var_dump(A::$it);
@@ -20,7 +20,7 @@ A::$a = &$a;
A::$it = new ArrayIterator();
try {
- $a = 1;
+ $a = 1;
} catch (TypeError $e) { var_dump($e->getMessage()); }
var_dump($a);
diff --git a/Zend/tests/type_declarations/typed_properties_081.phpt b/Zend/tests/type_declarations/typed_properties_081.phpt
index 4f49eae4e7..f6d2114c6f 100644
--- a/Zend/tests/type_declarations/typed_properties_081.phpt
+++ b/Zend/tests/type_declarations/typed_properties_081.phpt
@@ -12,7 +12,7 @@ $x =& $test->x;
$test2 = clone $test;
unset($test);
try {
- $x = "foo";
+ $x = "foo";
} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
var_dump($test2->x);
diff --git a/Zend/tests/type_declarations/typed_properties_082.phpt b/Zend/tests/type_declarations/typed_properties_082.phpt
index 1e4e62e89b..d212f1852c 100644
--- a/Zend/tests/type_declarations/typed_properties_082.phpt
+++ b/Zend/tests/type_declarations/typed_properties_082.phpt
@@ -4,16 +4,16 @@ Test typed references to static properties
<?php
class Test {
- public static int $x = 0;
+ public static int $x = 0;
}
class Test2 extends Test {
- public static $y = 1;
+ public static $y = 1;
}
$x =& Test::$x;
try {
- $x = "foo";
+ $x = "foo";
} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
var_dump($x, Test::$x);
diff --git a/Zend/tests/type_declarations/typed_properties_084.phpt b/Zend/tests/type_declarations/typed_properties_084.phpt
index fb3c86115e..f83be01d53 100644
--- a/Zend/tests/type_declarations/typed_properties_084.phpt
+++ b/Zend/tests/type_declarations/typed_properties_084.phpt
@@ -6,7 +6,7 @@ eval(<<<'PHP'
class Foo {}
class_alias('Foo', 'Bar');
PHP);
-
+
eval(<<<'PHP'
class A {
public Foo $prop;
diff --git a/Zend/tests/type_declarations/typed_properties_086.phpt b/Zend/tests/type_declarations/typed_properties_086.phpt
index c58eb7898e..7c160dd9d0 100644
--- a/Zend/tests/type_declarations/typed_properties_086.phpt
+++ b/Zend/tests/type_declarations/typed_properties_086.phpt
@@ -4,9 +4,9 @@ Test typed properties with integer keys
<?php
class T {
- // Class must have at least one property. Property must have a type.
- // Empty class or untyped property removes segfault
- public int $i;
+ // Class must have at least one property. Property must have a type.
+ // Empty class or untyped property removes segfault
+ public int $i;
}
$t = new T;
diff --git a/Zend/tests/type_declarations/typed_properties_089.phpt b/Zend/tests/type_declarations/typed_properties_089.phpt
index 1d59b8d945..92de4b64aa 100644
--- a/Zend/tests/type_declarations/typed_properties_089.phpt
+++ b/Zend/tests/type_declarations/typed_properties_089.phpt
@@ -4,17 +4,17 @@ Modification of typed property during assignment must not leak
<?php
class A {
- public string $prop = "";
+ public string $prop = "";
}
class B {
- public function __toString() {
- global $a;
- $a->prop = "dont ";
- $a->prop .= "leak ";
- $a->prop .= "me!";
- return "test";
- }
+ public function __toString() {
+ global $a;
+ $a->prop = "dont ";
+ $a->prop .= "leak ";
+ $a->prop .= "me!";
+ return "test";
+ }
}
$a = new A;
diff --git a/Zend/tests/type_declarations/typed_properties_090.phpt b/Zend/tests/type_declarations/typed_properties_090.phpt
index 3b75aaa843..97bd2ed523 100644
--- a/Zend/tests/type_declarations/typed_properties_090.phpt
+++ b/Zend/tests/type_declarations/typed_properties_090.phpt
@@ -4,17 +4,17 @@ Unsetting typed properties containing a reference must respect shadowing
<?php
class A {
- private int $prop = 42;
+ private int $prop = 42;
- public function test() {
- $x =& $this->prop;
- unset($this->prop);
- $x = "foo";
- var_dump($x);
- }
+ public function test() {
+ $x =& $this->prop;
+ unset($this->prop);
+ $x = "foo";
+ var_dump($x);
+ }
}
class B extends A {
- private $prop;
+ private $prop;
}
$b = new B;
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..8470d4f437 100644
--- a/Zend/tests/type_declarations/typed_properties_095.phpt
+++ b/Zend/tests/type_declarations/typed_properties_095.phpt
@@ -60,25 +60,29 @@ 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
-object(_ZendTestClass)#1 (2) {
+Cannot assign string to property _ZendTestClass::$intProp of type int
+Cannot assign _ZendTestClass to property _ZendTestClass::$classProp of type ?stdClass
+object(_ZendTestClass)#1 (3) {
["intProp"]=>
int(456)
["classProp"]=>
object(stdClass)#2 (0) {
}
+ ["classUnionProp"]=>
+ NULL
}
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
-object(Test)#4 (2) {
+Cannot assign string to property _ZendTestClass::$intProp of type int
+Cannot assign Test to property _ZendTestClass::$classProp of type ?stdClass
+object(Test)#4 (3) {
["intProp"]=>
int(456)
["classProp"]=>
object(stdClass)#1 (0) {
}
+ ["classUnionProp"]=>
+ NULL
}
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_100.phpt b/Zend/tests/type_declarations/typed_properties_100.phpt
index 8ee3deb0f7..675b79a7df 100644
--- a/Zend/tests/type_declarations/typed_properties_100.phpt
+++ b/Zend/tests/type_declarations/typed_properties_100.phpt
@@ -2,7 +2,7 @@
Property type not enforced for __get if the property is not visible
--FILE--
<?php
-
+
class Test {
private int $prop;
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_104.phpt b/Zend/tests/type_declarations/typed_properties_104.phpt
index e7d69e3d7d..b9fe405b97 100644
--- a/Zend/tests/type_declarations/typed_properties_104.phpt
+++ b/Zend/tests/type_declarations/typed_properties_104.phpt
@@ -4,11 +4,11 @@ Uninitialized result of PRE_INC/PRE_DEC in case of exception
<?php
declare(strict_types=1);
$o = new class {
- public string $a = "123";
+ public string $a = "123";
};
$x = & $o->a;
try {
- $ret = ++$x + 5;
+ $ret = ++$x + 5;
} catch (TypeError $e) {
}
?>
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/typed_properties_reference_coercion_leak.phpt b/Zend/tests/type_declarations/typed_properties_reference_coercion_leak.phpt
new file mode 100644
index 0000000000..57d09bef50
--- /dev/null
+++ b/Zend/tests/type_declarations/typed_properties_reference_coercion_leak.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Do not leak when assigning to reference set with multiple typed properties with type coercion
+--FILE--
+<?php
+
+class Test {
+ public string $x;
+ public string $y;
+}
+
+$test = new Test;
+$ref = "";
+$test->x =& $ref;
+$test->y =& $ref;
+$val = 42;
+$ref = $val;
+var_dump($ref, $val);
+
+?>
+--EXPECT--
+string(2) "42"
+int(42)
diff --git a/Zend/tests/type_declarations/types_in_ast.phpt b/Zend/tests/type_declarations/types_in_ast.phpt
index 54619c23b7..2e2fd212c7 100644
--- a/Zend/tests/type_declarations/types_in_ast.phpt
+++ b/Zend/tests/type_declarations/types_in_ast.phpt
@@ -6,11 +6,11 @@ assert.exception=0
--FILE--
<?php
assert(0 && ($a = function (int $a, ?int $b, int $c = null): ?int {
- $x = new class {
- public $a;
- public int $b;
- public ?int $c;
- };
+ $x = new class {
+ public $a;
+ public int $b;
+ public ?int $c;
+ };
}));
?>
--EXPECTF--
diff --git a/Zend/tests/type_declarations/union_types/anonymous_class.phpt b/Zend/tests/type_declarations/union_types/anonymous_class.phpt
new file mode 100644
index 0000000000..1e009f22b0
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/anonymous_class.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Union with anonymous class type
+--FILE--
+<?php
+
+$a = new class {
+ public function testParam(self|string $a)
+ {
+ }
+ public function test(): self|string
+ {
+ return new \stdClass;
+ }
+};
+
+try {
+ $a->testParam(null);
+} catch (\Throwable $e) {
+ echo $e->getMessage()."\n";
+}
+
+try {
+ $a->test();
+} catch (\Throwable $e) {
+ echo $e->getMessage()."\n";
+}
+?>
+--EXPECTF--
+class@anonymous(): Argument #1 ($a) must be of type class@anonymous|string, null given, called in %s on line %d
+class@anonymous::test(): Return value must be of type class@anonymous|string, stdClass returned
diff --git a/Zend/tests/type_declarations/union_types/generator_return_containing_extra_types.phpt b/Zend/tests/type_declarations/union_types/generator_return_containing_extra_types.phpt
new file mode 100644
index 0000000000..7c369090a5
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/generator_return_containing_extra_types.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Generator return value has to have Traversable-ish, but may also have extra types
+--FILE--
+<?php
+
+interface I {
+ public function test(): iterable|false;
+}
+
+class C implements I {
+ public function test(): iterable|false {
+ yield;
+ }
+}
+
+var_dump((new C)->test());
+
+?>
+--EXPECT--
+object(Generator)#2 (0) {
+}
diff --git a/Zend/tests/type_declarations/union_types/generator_return_multiple_classes.phpt b/Zend/tests/type_declarations/union_types/generator_return_multiple_classes.phpt
new file mode 100644
index 0000000000..8526c65537
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/generator_return_multiple_classes.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Generator return type with multiple classes
+--FILE--
+<?php
+
+interface I {
+ public function test(): Generator|ArrayAccess|array;
+}
+class C implements I {
+ function test(): Generator|ArrayAccess|array {
+ yield;
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/type_declarations/union_types/illegal_default_value_argument.phpt b/Zend/tests/type_declarations/union_types/illegal_default_value_argument.phpt
new file mode 100644
index 0000000000..6c40adc8f2
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/illegal_default_value_argument.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Argument default value not legal for any type in the union
+--FILE--
+<?php
+
+function test(int|float $arg = "0") {
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use string as default value for parameter $arg of type int|float in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/illegal_default_value_property.phpt b/Zend/tests/type_declarations/union_types/illegal_default_value_property.phpt
new file mode 100644
index 0000000000..f5941751dc
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/illegal_default_value_property.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Default value not legal for any type in the union
+--FILE--
+<?php
+
+class Test {
+ public int|float $prop = "0";
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use string as default value for property Test::$prop of type int|float in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/incdec_prop.phpt b/Zend/tests/type_declarations/union_types/incdec_prop.phpt
new file mode 100644
index 0000000000..dde6f59526
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/incdec_prop.phpt
@@ -0,0 +1,132 @@
+--TEST--
+Increment/decrement a typed property with int|float type
+--FILE--
+<?php
+
+class Test {
+ public int|float $prop;
+ public int|bool $prop2;
+}
+
+/* Incrementing a int|float property past int min/max is legal */
+
+$test = new Test;
+$test->prop = PHP_INT_MAX;
+$x = $test->prop++;
+var_dump(is_double($test->prop));
+
+$test->prop = PHP_INT_MAX;
+$x = ++$test->prop;
+var_dump(is_double($test->prop));
+
+$test->prop = PHP_INT_MIN;
+$x = $test->prop--;
+var_dump(is_double($test->prop));
+
+$test->prop = PHP_INT_MIN;
+$x = --$test->prop;
+var_dump(is_double($test->prop));
+
+$test = new Test;
+$test->prop = PHP_INT_MAX;
+$r =& $test->prop;
+$x = $test->prop++;
+var_dump(is_double($test->prop));
+
+$test->prop = PHP_INT_MAX;
+$x = ++$test->prop;
+$r =& $test->prop;
+var_dump(is_double($test->prop));
+
+$test->prop = PHP_INT_MIN;
+$x = $test->prop--;
+$r =& $test->prop;
+var_dump(is_double($test->prop));
+
+$test->prop = PHP_INT_MIN;
+$x = --$test->prop;
+$r =& $test->prop;
+var_dump(is_double($test->prop));
+
+/* Incrementing a non-int|float property past int min/max is an error,
+ * even if the result of the overflow (a float) would technically be allowed
+ * under a type coercion. */
+
+try {
+ $test->prop2 = PHP_INT_MAX;
+ $x = $test->prop2++;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ $test->prop2 = PHP_INT_MAX;
+ $x = ++$test->prop2;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ $test->prop2 = PHP_INT_MIN;
+ $x = $test->prop2--;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ $test->prop2 = PHP_INT_MIN;
+ $x = --$test->prop2;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ $test->prop2 = PHP_INT_MAX;
+ $r =& $test->prop2;
+ $x = $test->prop2++;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ $test->prop2 = PHP_INT_MAX;
+ $r =& $test->prop2;
+ $x = ++$test->prop2;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ $test->prop2 = PHP_INT_MIN;
+ $r =& $test->prop2;
+ $x = $test->prop2--;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ $test->prop2 = PHP_INT_MIN;
+ $r =& $test->prop2;
+ $x = --$test->prop2;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+Cannot increment property Test::$prop2 of type int|bool past its maximal value
+Cannot increment property Test::$prop2 of type int|bool past its maximal value
+Cannot decrement property Test::$prop2 of type int|bool past its minimal value
+Cannot decrement property Test::$prop2 of type int|bool past its minimal value
+Cannot increment a reference held by property Test::$prop2 of type int|bool past its maximal value
+Cannot increment a reference held by property Test::$prop2 of type int|bool past its maximal value
+Cannot decrement a reference held by property Test::$prop2 of type int|bool past its minimal value
+Cannot decrement a reference held by property Test::$prop2 of type int|bool past its minimal value
diff --git a/Zend/tests/type_declarations/union_types/inheritance.phpt b/Zend/tests/type_declarations/union_types/inheritance.phpt
new file mode 100644
index 0000000000..a0a1b65912
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/inheritance.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Various inheritance scenarios for properties/methods with union types
+--FILE--
+<?php
+
+class X {
+ public A|B|int $prop;
+ public function method(A|B|int $arg): A|B|int { }
+
+ private A|B|int $prop2;
+ private function method2(A|B|int $arg): A|B|int { }
+}
+
+class Y extends X {
+}
+
+trait T {
+ public A|B|int $prop;
+ public function method(A|B|int $arg): A|B|int { }
+
+ private A|B|int $prop2;
+ private function method2(A|B|int $arg): A|B|int { }
+}
+
+class Z {
+ use T;
+}
+
+class U extends X {
+ use T;
+}
+
+class V extends X {
+ use T;
+
+ public A|B|int $prop;
+ public function method(A|B|int $arg): A|B|int { }
+
+ private A|B|int $prop2;
+ private function method2(A|B|int $arg): A|B|int { }
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/type_declarations/union_types/inheritance_internal.phpt b/Zend/tests/type_declarations/union_types/inheritance_internal.phpt
new file mode 100644
index 0000000000..bb53411cad
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/inheritance_internal.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Inheritance of union type from internal class
+--SKIPIF--
+<?php
+if (!extension_loaded('zend-test')) die('skip requires zend-test extension');
+?>
+--FILE--
+<?php
+
+class C extends _ZendTestClass {}
+
+$obj = new _ZendTestChildClass;
+$obj->classUnionProp = new stdClass;
+$obj->classUnionProp = new ArrayIterator;
+try {
+ $obj->classUnionProp = new DateTime;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+$obj = new C;
+$obj->classUnionProp = new stdClass;
+$obj->classUnionProp = new ArrayIterator;
+try {
+ $obj->classUnionProp = new DateTime;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null
+Cannot assign DateTime to property _ZendTestClass::$classUnionProp of type stdClass|Iterator|null
diff --git a/Zend/tests/type_declarations/union_types/legal_default_values.phpt b/Zend/tests/type_declarations/union_types/legal_default_values.phpt
new file mode 100644
index 0000000000..36f16da69a
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/legal_default_values.phpt
@@ -0,0 +1,45 @@
+--TEST--
+The default value must be legal for one of the type in the union
+--FILE--
+<?php
+
+class Test {
+ public int|float $a = 1;
+ public int|float $b = 2.0;
+ public float|string $c = 3; // Strict typing exception
+ public float|string $d = 4.0;
+ public float|string $e = "5";
+}
+
+function test(
+ int|float $a = 1,
+ int|float $b = 2.0,
+ float|string $c = 3, // Strict typing exception
+ float|string $d = 4.0,
+ float|string $e = "5"
+) {
+ var_dump($a, $b, $c, $d, $e);
+}
+
+var_dump(new Test);
+test();
+
+?>
+--EXPECT--
+object(Test)#1 (5) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ float(2)
+ ["c"]=>
+ float(3)
+ ["d"]=>
+ float(4)
+ ["e"]=>
+ string(1) "5"
+}
+int(1)
+float(2)
+float(3)
+float(4)
+string(1) "5"
diff --git a/Zend/tests/type_declarations/union_types/multiple_classes.phpt b/Zend/tests/type_declarations/union_types/multiple_classes.phpt
new file mode 100644
index 0000000000..b45fc02d83
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/multiple_classes.phpt
@@ -0,0 +1,83 @@
+--TEST--
+Union types with multiple classes
+--FILE--
+<?php
+
+class Test {
+ public X|Y|Z|int $prop;
+ public function method(X|Y|Z|int $arg): X|Y|Z|int {
+ return $arg;
+ }
+}
+
+// Check that nothing here triggers autoloading.
+spl_autoload_register(function($class) {
+ echo "Loading $class\n";
+});
+
+$test = new Test;
+
+$test->prop = 42;
+var_dump($test->prop);
+var_dump($test->method(42));
+
+$test->prop = "42";
+var_dump($test->prop);
+var_dump($test->method("42"));
+
+try {
+ $test->prop = new stdClass;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ $test->method(new stdClass);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+if (true) {
+ class X {}
+}
+
+$test->prop = new X;
+var_dump($test->prop);
+var_dump($test->method(new X));
+
+if (true) {
+ class Z {}
+}
+
+$test->prop = new Z;
+var_dump($test->prop);
+var_dump($test->method(new Z));
+
+if (true) {
+ class Y {}
+}
+
+$test->prop = new Y;
+var_dump($test->prop);
+var_dump($test->method(new Y));
+
+?>
+--EXPECTF--
+int(42)
+int(42)
+int(42)
+int(42)
+Cannot assign stdClass to property Test::$prop of type X|Y|Z|int
+Test::method(): Argument #1 ($arg) must be of type X|Y|Z|int, stdClass given, called in %s on line %d
+object(X)#4 (0) {
+}
+object(X)#6 (0) {
+}
+object(Z)#6 (0) {
+}
+object(Z)#4 (0) {
+}
+object(Y)#4 (0) {
+}
+object(Y)#6 (0) {
+}
diff --git a/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt b/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt
new file mode 100644
index 0000000000..a8db8fca9c
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/prop_ref_assign.phpt
@@ -0,0 +1,59 @@
+--TEST--
+Assignments to references that are held by properties with union types
+--FILE--
+<?php
+
+class Test {
+ public int|string $x;
+ public float|string $y;
+}
+
+$test = new Test;
+$r = "foobar";
+$test->x =& $r;
+$test->y =& $r;
+
+$v = 42;
+try {
+ $r = $v;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+var_dump($r, $v);
+
+$v = 42.0;
+try {
+ $r = $v;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+var_dump($r, $v);
+
+unset($r, $test->x, $test->y);
+
+$test->x = 42;
+try {
+ $test->y =& $test->x;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+unset($test->x, $test->y);
+
+$test->y = 42.0;
+try {
+ $test->x =& $test->y;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Cannot assign int to reference held by property Test::$x of type string|int and property Test::$y of type string|float, as this would result in an inconsistent type conversion
+string(6) "foobar"
+int(42)
+Cannot assign float to reference held by property Test::$x of type string|int and property Test::$y of type string|float, as this would result in an inconsistent type conversion
+string(6) "foobar"
+float(42)
+Reference with value of type int held by property Test::$x of type string|int is not compatible with property Test::$y of type string|float
+Reference with value of type float held by property Test::$y of type string|float is not compatible with property Test::$x of type string|int
diff --git a/Zend/tests/type_declarations/union_types/redundant_types/bool_and_false.phpt b/Zend/tests/type_declarations/union_types/redundant_types/bool_and_false.phpt
new file mode 100644
index 0000000000..91d2d940f6
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/redundant_types/bool_and_false.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Using both bool and false in a union
+--FILE--
+<?php
+
+function test(): bool|false {
+}
+
+?>
+--EXPECTF--
+Fatal error: Duplicate type false is redundant in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/redundant_types/duplicate_class_type.phpt b/Zend/tests/type_declarations/union_types/redundant_types/duplicate_class_type.phpt
new file mode 100644
index 0000000000..5739f699e7
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/redundant_types/duplicate_class_type.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Duplicate class type
+--FILE--
+<?php
+
+function test(): Foo|int|FOO {
+}
+
+?>
+--EXPECTF--
+Fatal error: Duplicate type FOO is redundant in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/redundant_types/duplicate_type.phpt b/Zend/tests/type_declarations/union_types/redundant_types/duplicate_type.phpt
new file mode 100644
index 0000000000..f9cd3e01fa
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/redundant_types/duplicate_type.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Using a type twice in a union
+--FILE--
+<?php
+
+function test(): int|INT {
+}
+
+?>
+--EXPECTF--
+Fatal error: Duplicate type int is redundant in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable.phpt b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable.phpt
new file mode 100644
index 0000000000..5b65a33de1
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Using both iterable and Traversable
+--FILE--
+<?php
+
+function test(): iterable|Traversable {
+}
+
+?>
+--EXPECTF--
+Fatal error: Type Traversable|iterable contains both iterable and Traversable, which is redundant in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable_2.phpt b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable_2.phpt
new file mode 100644
index 0000000000..e3f7c5858b
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_Traversable_2.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Using both iterable and Traversable, with extra classes
+--FILE--
+<?php
+
+function test(): iterable|Traversable|ArrayAccess {
+}
+
+?>
+--EXPECTF--
+Fatal error: Type Traversable|ArrayAccess|iterable contains both iterable and Traversable, which is redundant in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_array.phpt b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_array.phpt
new file mode 100644
index 0000000000..c6b0949418
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/redundant_types/iterable_and_array.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Using both iterable and array
+--FILE--
+<?php
+
+function test(): iterable|array {
+}
+
+?>
+--EXPECTF--
+Fatal error: Type iterable|array contains both iterable and array, which is redundant in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/redundant_types/nullable_null.phpt b/Zend/tests/type_declarations/union_types/redundant_types/nullable_null.phpt
new file mode 100644
index 0000000000..5597794c86
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/redundant_types/nullable_null.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Combining nullability with null
+--FILE--
+<?php
+
+function test(): ?null {
+}
+
+?>
+--EXPECTF--
+Fatal error: Null can not be used as a standalone type in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/redundant_types/object_and_class_type.phpt b/Zend/tests/type_declarations/union_types/redundant_types/object_and_class_type.phpt
new file mode 100644
index 0000000000..e9f785ed17
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/redundant_types/object_and_class_type.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Using both object and a class type
+--FILE--
+<?php
+
+function test(): object|Test {
+}
+
+?>
+--EXPECTF--
+Fatal error: Type Test|object contains both object and a class type, which is redundant in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/redundant_types/object_and_static.phpt b/Zend/tests/type_declarations/union_types/redundant_types/object_and_static.phpt
new file mode 100644
index 0000000000..f4152c2a23
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/redundant_types/object_and_static.phpt
@@ -0,0 +1,12 @@
+--TEST--
+object and static are redundant
+--FILE--
+<?php
+
+class Test {
+ public function foo(): static|object {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Type static|object contains both object and a class type, which is redundant in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/standalone_false.phpt b/Zend/tests/type_declarations/union_types/standalone_false.phpt
new file mode 100644
index 0000000000..3932f929e5
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/standalone_false.phpt
@@ -0,0 +1,10 @@
+--TEST--
+False cannot be used as a standalone type
+--FILE--
+<?php
+
+function test(): false {}
+
+?>
+--EXPECTF--
+Fatal error: False can not be used as a standalone type in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/standalone_null.phpt b/Zend/tests/type_declarations/union_types/standalone_null.phpt
new file mode 100644
index 0000000000..7a25f9cd05
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/standalone_null.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Null cannot be used as a standalone type
+--FILE--
+<?php
+
+function test(): null {}
+
+?>
+--EXPECTF--
+Fatal error: Null can not be used as a standalone type in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/standalone_nullable_false.phpt b/Zend/tests/type_declarations/union_types/standalone_nullable_false.phpt
new file mode 100644
index 0000000000..1e680249b0
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/standalone_nullable_false.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Nullable false cannot be used as a standalone type
+--FILE--
+<?php
+
+function test(): ?false {}
+
+?>
+--EXPECTF--
+Fatal error: False can not be used as a standalone type in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/type_checking_strict.phpt b/Zend/tests/type_declarations/union_types/type_checking_strict.phpt
new file mode 100644
index 0000000000..7054a7cc19
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/type_checking_strict.phpt
@@ -0,0 +1,207 @@
+--TEST--
+Behavior of union type checks (strict)
+--FILE--
+<?php
+
+declare(strict_types=1);
+
+function dump($value) {
+ if (is_object($value)) {
+ return 'new ' . get_class($value);
+ }
+ if ($value === INF) {
+ return 'INF';
+ }
+ return json_encode($value, JSON_PRESERVE_ZERO_FRACTION);
+}
+
+function test(string $type, array $values) {
+ $alignment = 16;
+
+ echo "\nType $type:\n";
+ $fn = eval("return function($type \$arg) { return \$arg; };");
+ foreach ($values as $value) {
+ echo str_pad(dump($value), $alignment), ' => ';
+
+ try {
+ error_clear_last();
+ $value = @$fn($value);
+ echo dump($value);
+ if ($e = error_get_last()) {
+ echo ' (', $e['message'], ')';
+ }
+ } catch (TypeError $e) {
+ $msg = $e->getMessage();
+ $msg = strstr($msg, ', called in', true);
+ $msg = str_replace('{closure}(): Argument #1 ($arg)', 'Argument ...', $msg);
+ echo $msg;
+ }
+ echo "\n";
+ }
+}
+
+class WithToString {
+ public function __toString() {
+ return "__toString()";
+ }
+}
+
+$values = [
+ 42, 42.0, INF, "42", "42.0", "42x", "x", "",
+ true, false, null, [], new stdClass, new WithToString,
+];
+test('int|float', $values);
+test('int|float|false', $values);
+test('int|float|bool', $values);
+test('int|bool', $values);
+test('int|string|null', $values);
+test('string|bool', $values);
+test('float|array', $values);
+test('string|array', $values);
+test('bool|array', $values);
+
+?>
+--EXPECT--
+Type int|float:
+42 => 42
+42.0 => 42.0
+INF => INF
+"42" => Argument ... must be of type int|float, string given
+"42.0" => Argument ... must be of type int|float, string given
+"42x" => Argument ... must be of type int|float, string given
+"x" => Argument ... must be of type int|float, string given
+"" => Argument ... must be of type int|float, string given
+true => Argument ... must be of type int|float, bool given
+false => Argument ... must be of type int|float, bool given
+null => Argument ... must be of type int|float, null given
+[] => Argument ... must be of type int|float, array given
+new stdClass => Argument ... must be of type int|float, stdClass given
+new WithToString => Argument ... must be of type int|float, WithToString given
+
+Type int|float|false:
+42 => 42
+42.0 => 42.0
+INF => INF
+"42" => Argument ... must be of type int|float|false, string given
+"42.0" => Argument ... must be of type int|float|false, string given
+"42x" => Argument ... must be of type int|float|false, string given
+"x" => Argument ... must be of type int|float|false, string given
+"" => Argument ... must be of type int|float|false, string given
+true => Argument ... must be of type int|float|false, bool given
+false => false
+null => Argument ... must be of type int|float|false, null given
+[] => Argument ... must be of type int|float|false, array given
+new stdClass => Argument ... must be of type int|float|false, stdClass given
+new WithToString => Argument ... must be of type int|float|false, WithToString given
+
+Type int|float|bool:
+42 => 42
+42.0 => 42.0
+INF => INF
+"42" => Argument ... must be of type int|float|bool, string given
+"42.0" => Argument ... must be of type int|float|bool, string given
+"42x" => Argument ... must be of type int|float|bool, string given
+"x" => Argument ... must be of type int|float|bool, string given
+"" => Argument ... must be of type int|float|bool, string given
+true => true
+false => false
+null => Argument ... must be of type int|float|bool, null given
+[] => Argument ... must be of type int|float|bool, array given
+new stdClass => Argument ... must be of type int|float|bool, stdClass given
+new WithToString => Argument ... must be of type int|float|bool, WithToString given
+
+Type int|bool:
+42 => 42
+42.0 => Argument ... must be of type int|bool, float given
+INF => Argument ... must be of type int|bool, float given
+"42" => Argument ... must be of type int|bool, string given
+"42.0" => Argument ... must be of type int|bool, string given
+"42x" => Argument ... must be of type int|bool, string given
+"x" => Argument ... must be of type int|bool, string given
+"" => Argument ... must be of type int|bool, string given
+true => true
+false => false
+null => Argument ... must be of type int|bool, null given
+[] => Argument ... must be of type int|bool, array given
+new stdClass => Argument ... must be of type int|bool, stdClass given
+new WithToString => Argument ... must be of type int|bool, WithToString given
+
+Type int|string|null:
+42 => 42
+42.0 => Argument ... must be of type string|int|null, float given
+INF => Argument ... must be of type string|int|null, float given
+"42" => "42"
+"42.0" => "42.0"
+"42x" => "42x"
+"x" => "x"
+"" => ""
+true => Argument ... must be of type string|int|null, bool given
+false => Argument ... must be of type string|int|null, bool given
+null => null
+[] => Argument ... must be of type string|int|null, array given
+new stdClass => Argument ... must be of type string|int|null, stdClass given
+new WithToString => Argument ... must be of type string|int|null, WithToString given
+
+Type string|bool:
+42 => Argument ... must be of type string|bool, int given
+42.0 => Argument ... must be of type string|bool, float given
+INF => Argument ... must be of type string|bool, float given
+"42" => "42"
+"42.0" => "42.0"
+"42x" => "42x"
+"x" => "x"
+"" => ""
+true => true
+false => false
+null => Argument ... must be of type string|bool, null given
+[] => Argument ... must be of type string|bool, array given
+new stdClass => Argument ... must be of type string|bool, stdClass given
+new WithToString => Argument ... must be of type string|bool, WithToString given
+
+Type float|array:
+42 => 42.0
+42.0 => 42.0
+INF => INF
+"42" => Argument ... must be of type array|float, string given
+"42.0" => Argument ... must be of type array|float, string given
+"42x" => Argument ... must be of type array|float, string given
+"x" => Argument ... must be of type array|float, string given
+"" => Argument ... must be of type array|float, string given
+true => Argument ... must be of type array|float, bool given
+false => Argument ... must be of type array|float, bool given
+null => Argument ... must be of type array|float, null given
+[] => []
+new stdClass => Argument ... must be of type array|float, stdClass given
+new WithToString => Argument ... must be of type array|float, WithToString given
+
+Type string|array:
+42 => Argument ... must be of type array|string, int given
+42.0 => Argument ... must be of type array|string, float given
+INF => Argument ... must be of type array|string, float given
+"42" => "42"
+"42.0" => "42.0"
+"42x" => "42x"
+"x" => "x"
+"" => ""
+true => Argument ... must be of type array|string, bool given
+false => Argument ... must be of type array|string, bool given
+null => Argument ... must be of type array|string, null given
+[] => []
+new stdClass => Argument ... must be of type array|string, stdClass given
+new WithToString => Argument ... must be of type array|string, WithToString given
+
+Type bool|array:
+42 => Argument ... must be of type array|bool, int given
+42.0 => Argument ... must be of type array|bool, float given
+INF => Argument ... must be of type array|bool, float given
+"42" => Argument ... must be of type array|bool, string given
+"42.0" => Argument ... must be of type array|bool, string given
+"42x" => Argument ... must be of type array|bool, string given
+"x" => Argument ... must be of type array|bool, string given
+"" => Argument ... must be of type array|bool, string given
+true => true
+false => false
+null => Argument ... must be of type array|bool, null given
+[] => []
+new stdClass => Argument ... must be of type array|bool, stdClass given
+new WithToString => Argument ... must be of type array|bool, WithToString given
diff --git a/Zend/tests/type_declarations/union_types/type_checking_weak.phpt b/Zend/tests/type_declarations/union_types/type_checking_weak.phpt
new file mode 100644
index 0000000000..351a3e9e78
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/type_checking_weak.phpt
@@ -0,0 +1,205 @@
+--TEST--
+Behavior of union type checks (weak)
+--FILE--
+<?php
+
+function dump($value) {
+ if (is_object($value)) {
+ return 'new ' . get_class($value);
+ }
+ if ($value === INF) {
+ return 'INF';
+ }
+ return json_encode($value, JSON_PRESERVE_ZERO_FRACTION);
+}
+
+function test(string $type, array $values) {
+ $alignment = 16;
+
+ echo "\nType $type:\n";
+ $fn = eval("return function($type \$arg) { return \$arg; };");
+ foreach ($values as $value) {
+ echo str_pad(dump($value), $alignment), ' => ';
+
+ try {
+ error_clear_last();
+ $value = @$fn($value);
+ echo dump($value);
+ if ($e = error_get_last()) {
+ echo ' (', $e['message'], ')';
+ }
+ } catch (TypeError $e) {
+ $msg = $e->getMessage();
+ $msg = strstr($msg, ', called in', true);
+ $msg = str_replace('{closure}(): Argument #1 ($arg)', 'Argument ...', $msg);
+ echo $msg;
+ }
+ echo "\n";
+ }
+}
+
+class WithToString {
+ public function __toString() {
+ return "__toString()";
+ }
+}
+
+$values = [
+ 42, 42.0, INF, "42", "42.0", "42x", "x", "",
+ true, false, null, [], new stdClass, new WithToString,
+];
+test('int|float', $values);
+test('int|float|false', $values);
+test('int|float|bool', $values);
+test('int|bool', $values);
+test('int|string|null', $values);
+test('string|bool', $values);
+test('float|array', $values);
+test('string|array', $values);
+test('bool|array', $values);
+
+?>
+--EXPECT--
+Type int|float:
+42 => 42
+42.0 => 42.0
+INF => INF
+"42" => 42
+"42.0" => 42.0
+"42x" => Argument ... must be of type int|float, string given
+"x" => Argument ... must be of type int|float, string given
+"" => Argument ... must be of type int|float, string given
+true => 1
+false => 0
+null => Argument ... must be of type int|float, null given
+[] => Argument ... must be of type int|float, array given
+new stdClass => Argument ... must be of type int|float, stdClass given
+new WithToString => Argument ... must be of type int|float, WithToString given
+
+Type int|float|false:
+42 => 42
+42.0 => 42.0
+INF => INF
+"42" => 42
+"42.0" => 42.0
+"42x" => Argument ... must be of type int|float|false, string given
+"x" => Argument ... must be of type int|float|false, string given
+"" => Argument ... must be of type int|float|false, string given
+true => 1
+false => false
+null => Argument ... must be of type int|float|false, null given
+[] => Argument ... must be of type int|float|false, array given
+new stdClass => Argument ... must be of type int|float|false, stdClass given
+new WithToString => Argument ... must be of type int|float|false, WithToString given
+
+Type int|float|bool:
+42 => 42
+42.0 => 42.0
+INF => INF
+"42" => 42
+"42.0" => 42.0
+"42x" => true
+"x" => true
+"" => false
+true => true
+false => false
+null => Argument ... must be of type int|float|bool, null given
+[] => Argument ... must be of type int|float|bool, array given
+new stdClass => Argument ... must be of type int|float|bool, stdClass given
+new WithToString => Argument ... must be of type int|float|bool, WithToString given
+
+Type int|bool:
+42 => 42
+42.0 => 42
+INF => true
+"42" => 42
+"42.0" => 42
+"42x" => true
+"x" => true
+"" => false
+true => true
+false => false
+null => Argument ... must be of type int|bool, null given
+[] => Argument ... must be of type int|bool, array given
+new stdClass => Argument ... must be of type int|bool, stdClass given
+new WithToString => Argument ... must be of type int|bool, WithToString given
+
+Type int|string|null:
+42 => 42
+42.0 => 42
+INF => "INF"
+"42" => "42"
+"42.0" => "42.0"
+"42x" => "42x"
+"x" => "x"
+"" => ""
+true => 1
+false => 0
+null => null
+[] => Argument ... must be of type string|int|null, array given
+new stdClass => Argument ... must be of type string|int|null, stdClass given
+new WithToString => "__toString()"
+
+Type string|bool:
+42 => "42"
+42.0 => "42"
+INF => "INF"
+"42" => "42"
+"42.0" => "42.0"
+"42x" => "42x"
+"x" => "x"
+"" => ""
+true => true
+false => false
+null => Argument ... must be of type string|bool, null given
+[] => Argument ... must be of type string|bool, array given
+new stdClass => Argument ... must be of type string|bool, stdClass given
+new WithToString => "__toString()"
+
+Type float|array:
+42 => 42.0
+42.0 => 42.0
+INF => INF
+"42" => 42.0
+"42.0" => 42.0
+"42x" => Argument ... must be of type array|float, string given
+"x" => Argument ... must be of type array|float, string given
+"" => Argument ... must be of type array|float, string given
+true => 1.0
+false => 0.0
+null => Argument ... must be of type array|float, null given
+[] => []
+new stdClass => Argument ... must be of type array|float, stdClass given
+new WithToString => Argument ... must be of type array|float, WithToString given
+
+Type string|array:
+42 => "42"
+42.0 => "42"
+INF => "INF"
+"42" => "42"
+"42.0" => "42.0"
+"42x" => "42x"
+"x" => "x"
+"" => ""
+true => "1"
+false => ""
+null => Argument ... must be of type array|string, null given
+[] => []
+new stdClass => Argument ... must be of type array|string, stdClass given
+new WithToString => "__toString()"
+
+Type bool|array:
+42 => true
+42.0 => true
+INF => true
+"42" => true
+"42.0" => true
+"42x" => true
+"x" => true
+"" => false
+true => true
+false => false
+null => Argument ... must be of type array|bool, null given
+[] => []
+new stdClass => Argument ... must be of type array|bool, stdClass given
+new WithToString => Argument ... must be of type array|bool, WithToString given
diff --git a/Zend/tests/type_declarations/union_types/variance/invalid_001.phpt b/Zend/tests/type_declarations/union_types/variance/invalid_001.phpt
new file mode 100644
index 0000000000..9e1dcaefa1
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/variance/invalid_001.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Invalid union type variance: Adding extra return type
+--FILE--
+<?php
+
+class A {
+ public function method(): int {}
+}
+class B extends A {
+ public function method(): int|float {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of B::method(): int|float must be compatible with A::method(): int in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/variance/invalid_002.phpt b/Zend/tests/type_declarations/union_types/variance/invalid_002.phpt
new file mode 100644
index 0000000000..4448114fce
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/variance/invalid_002.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Invalid union type variance: Removing argument union type
+--FILE--
+<?php
+
+class A {
+ public function method(int|float $a) {}
+}
+class B extends A {
+ public function method(int $a) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of B::method(int $a) must be compatible with A::method(int|float $a) in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/variance/invalid_003.phpt b/Zend/tests/type_declarations/union_types/variance/invalid_003.phpt
new file mode 100644
index 0000000000..26d9ae3eb4
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/variance/invalid_003.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Invalid union type variance: Using parent of class in return type
+--FILE--
+<?php
+
+class X {}
+class Y extends X {}
+
+class A {
+ public function method(): Y|string {}
+}
+class B extends A {
+ public function method(): X|string {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of B::method(): X|string must be compatible with A::method(): Y|string in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/variance/invalid_004.phpt b/Zend/tests/type_declarations/union_types/variance/invalid_004.phpt
new file mode 100644
index 0000000000..3bcb6f9f55
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/variance/invalid_004.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Invalid property inheritance where one direction is valid and the other unresolved
+--FILE--
+<?php
+class A {
+ public X|B $prop;
+}
+class B extends A {
+ public B $prop;
+}
+?>
+--EXPECTF--
+Fatal error: Type of B::$prop must be X|B (as in class A) in %s on line %d
diff --git a/Zend/tests/type_declarations/union_types/variance/valid.phpt b/Zend/tests/type_declarations/union_types/variance/valid.phpt
new file mode 100644
index 0000000000..f9e5cc4980
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/variance/valid.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Valid union type variance
+--FILE--
+<?php
+
+class X {}
+class Y extends X {}
+
+class A {
+ public X|Y $prop;
+ public iterable $prop2;
+
+ public function method(int $a): int|float {}
+ public function method2(B|string $a): A|string {}
+ public function method3(Y|B $a): X|A {}
+ public function method4(Traversable|X $a): iterable|X {}
+}
+class B extends A {
+ public X $prop;
+ public array|Traversable $prop2;
+
+ public function method(int|float $a): int {}
+ public function method2(A|string $a): B|string {}
+ public function method3(A|X $a): B|Y {}
+ public function method4(iterable|X $a): Traversable|X {}
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/type_declarations/union_types/void_with_class.phpt b/Zend/tests/type_declarations/union_types/void_with_class.phpt
new file mode 100644
index 0000000000..6e1f439e31
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/void_with_class.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Combining void with class type
+--FILE--
+<?php
+
+function test(): T|void {}
+
+?>
+--EXPECTF--
+Fatal error: Void can only be used as a standalone type in %s on line %d
diff --git a/Zend/tests/type_declarations/variance/class_order_autoload1.phpt b/Zend/tests/type_declarations/variance/class_order_autoload1.phpt
index d68d2e8afa..d5ecfa7200 100644
--- a/Zend/tests/type_declarations/variance/class_order_autoload1.phpt
+++ b/Zend/tests/type_declarations/variance/class_order_autoload1.phpt
@@ -24,7 +24,6 @@ spl_autoload_register(function($class) {
var_dump(new C);
?>
-===DONE===
--EXPECT--
object(A)#2 (0) {
}
@@ -34,4 +33,3 @@ object(C)#2 (0) {
}
object(C)#2 (0) {
}
-===DONE===
diff --git a/Zend/tests/type_declarations/variance/class_order_autoload2.phpt b/Zend/tests/type_declarations/variance/class_order_autoload2.phpt
index f6229d3995..36414f5fe6 100644
--- a/Zend/tests/type_declarations/variance/class_order_autoload2.phpt
+++ b/Zend/tests/type_declarations/variance/class_order_autoload2.phpt
@@ -25,7 +25,6 @@ spl_autoload_register(function($class) {
var_dump(new B);
?>
-===DONE===
--EXPECT--
object(A)#2 (0) {
}
@@ -35,4 +34,3 @@ object(B)#2 (0) {
}
object(B)#2 (0) {
}
-===DONE===
diff --git a/Zend/tests/type_declarations/variance/class_order_autoload3.phpt b/Zend/tests/type_declarations/variance/class_order_autoload3.phpt
index d09f2a9c45..0f34aa224e 100644
--- a/Zend/tests/type_declarations/variance/class_order_autoload3.phpt
+++ b/Zend/tests/type_declarations/variance/class_order_autoload3.phpt
@@ -30,7 +30,6 @@ spl_autoload_register(function($class) {
var_dump(new B);
?>
-===DONE===
--EXPECT--
object(A)#2 (0) {
}
@@ -42,4 +41,3 @@ object(B)#2 (0) {
}
object(B)#2 (0) {
}
-===DONE===
diff --git a/Zend/tests/type_declarations/variance/class_order_autoload4.phpt b/Zend/tests/type_declarations/variance/class_order_autoload4.phpt
index 37070b444c..f426f8b44d 100644
--- a/Zend/tests/type_declarations/variance/class_order_autoload4.phpt
+++ b/Zend/tests/type_declarations/variance/class_order_autoload4.phpt
@@ -31,7 +31,6 @@ spl_autoload_register(function($class) {
var_dump(new B);
?>
-===DONE===
--EXPECT--
object(A)#2 (0) {
}
@@ -41,4 +40,3 @@ object(B)#2 (0) {
}
object(B)#2 (0) {
}
-===DONE===
diff --git a/Zend/tests/type_declarations/variance/class_order_autoload5.phpt b/Zend/tests/type_declarations/variance/class_order_autoload5.phpt
index 77e9a0a9ec..dcb97852aa 100644
--- a/Zend/tests/type_declarations/variance/class_order_autoload5.phpt
+++ b/Zend/tests/type_declarations/variance/class_order_autoload5.phpt
@@ -41,7 +41,6 @@ spl_autoload_register(function($class) {
var_dump(new B);
?>
-===DONE===
--EXPECT--
object(A)#2 (0) {
}
@@ -57,4 +56,3 @@ object(B)#2 (0) {
}
object(B)#2 (0) {
}
-===DONE===
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/infinite_recursion.phpt b/Zend/tests/type_declarations/variance/infinite_recursion.phpt
new file mode 100644
index 0000000000..6eab6ff7a5
--- /dev/null
+++ b/Zend/tests/type_declarations/variance/infinite_recursion.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Infinite recursion in unlinked_instanceof()
+--FILE--
+<?php
+interface I {}
+spl_autoload_register(function() {
+ class X {
+ function test(): I {}
+ }
+ class Y extends X {
+ function test(): C {}
+ }
+});
+class C extends Z implements C {}
+?>
+--EXPECTF--
+Fatal error: Declaration of Y::test(): C must be compatible with X::test(): I in %s on line %d
diff --git a/Zend/tests/type_declarations/variance/internal_parent.phpt b/Zend/tests/type_declarations/variance/internal_parent.phpt
index eaef902b66..c82e10ffc3 100644
--- a/Zend/tests/type_declarations/variance/internal_parent.phpt
+++ b/Zend/tests/type_declarations/variance/internal_parent.phpt
@@ -4,9 +4,9 @@ Internal class as parent
<?php
class Test extends DateTime {
- public static function createFromFormat($format, $time, Wrong $timezone = null) { }
+ public static function createFromFormat($format, $datetime, Wrong $timezone = null) { }
}
?>
--EXPECTF--
-Warning: Could not check compatibility between Test::createFromFormat($format, $time, ?Wrong $timezone = NULL) and DateTime::createFromFormat($format, $time, ?DateTimeZone $object = NULL), because class Wrong is not available in %s on line %d
+Fatal error: Could not check compatibility between Test::createFromFormat($format, $datetime, ?Wrong $timezone = null) and DateTime::createFromFormat(string $format, string $datetime, ?DateTimeZone $timezone = null), because class Wrong is not available in %s on line %d
diff --git a/Zend/tests/type_declarations/variance/loading_exception1.phpt b/Zend/tests/type_declarations/variance/loading_exception1.phpt
index 89aeaf3c12..b535e49112 100644
--- a/Zend/tests/type_declarations/variance/loading_exception1.phpt
+++ b/Zend/tests/type_declarations/variance/loading_exception1.phpt
@@ -44,6 +44,5 @@ Class A does not exist
Fatal error: During inheritance of B with variance dependencies: Uncaught Exception: Class A does not exist in %s:%d
Stack trace:
-#0 [internal function]: {closure}('A')
-#1 %s(%d): spl_autoload_call('A')
-#2 {main} in %s on line %d
+#0 %s(%d): {closure}('A')
+#1 {main} in %s on line %d
diff --git a/Zend/tests/type_declarations/variance/loading_exception2.phpt b/Zend/tests/type_declarations/variance/loading_exception2.phpt
index 2b46c183c2..f292643258 100644
--- a/Zend/tests/type_declarations/variance/loading_exception2.phpt
+++ b/Zend/tests/type_declarations/variance/loading_exception2.phpt
@@ -46,6 +46,5 @@ Class I does not exist
Fatal error: During inheritance of B with variance dependencies: Uncaught Exception: Class I does not exist in %s:%d
Stack trace:
-#0 [internal function]: {closure}('I')
-#1 %s(%d): spl_autoload_call('I')
-#2 {main} in %s on line %d
+#0 %s(%d): {closure}('I')
+#1 {main} 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/static_variance_failure.phpt b/Zend/tests/type_declarations/variance/static_variance_failure.phpt
new file mode 100644
index 0000000000..159a69c306
--- /dev/null
+++ b/Zend/tests/type_declarations/variance/static_variance_failure.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Failure case for static variance: Replace static with self
+--FILE--
+<?php
+
+class A {
+ public function test(): static {}
+}
+class B extends A {
+ public function test(): self {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of B::test(): B must be compatible with A::test(): static in %s on line %d
diff --git a/Zend/tests/type_declarations/variance/static_variance_success.phpt b/Zend/tests/type_declarations/variance/static_variance_success.phpt
new file mode 100644
index 0000000000..3749d8d874
--- /dev/null
+++ b/Zend/tests/type_declarations/variance/static_variance_success.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Success cases for static variance
+--FILE--
+<?php
+
+class A {
+ public function test1(): self {}
+ public function test2(): B {}
+ public function test3(): object {}
+ public function test4(): X|Y|self {}
+ public function test5(): ?static {}
+}
+
+class B extends A {
+ public function test1(): static {}
+ public function test2(): static {}
+ public function test3(): static {}
+ public function test4(): X|Y|static {}
+ public function test5(): static {}
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/type_declarations/variance/stringable.phpt b/Zend/tests/type_declarations/variance/stringable.phpt
new file mode 100644
index 0000000000..a132080106
--- /dev/null
+++ b/Zend/tests/type_declarations/variance/stringable.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Automatic Stringable implementation participates in variance
+--FILE--
+<?php
+
+class Foo {
+ public function test(): Stringable {}
+}
+class Bar extends Foo {
+ public function test(): Bar {}
+ public function __toString() {}
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt b/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt
index fcce42424d..2b5a9c8423 100644
--- a/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt
+++ b/Zend/tests/type_declarations/variance/unlinked_parent_1.phpt
@@ -16,4 +16,4 @@ try {
?>
--EXPECT--
-Class 'B' not found
+Class "B" not found
diff --git a/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt b/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt
index b947c6f4b6..247e1cf2b1 100644
--- a/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt
+++ b/Zend/tests/type_declarations/variance/unlinked_parent_2.phpt
@@ -16,4 +16,4 @@ try {
?>
--EXPECT--
-Interface 'B' not found
+Interface "B" not found
diff --git a/Zend/tests/type_declarations/weak_include_strict.phpt b/Zend/tests/type_declarations/weak_include_strict.phpt
index 52f5f55cdb..9bf6c0a47f 100644
--- a/Zend/tests/type_declarations/weak_include_strict.phpt
+++ b/Zend/tests/type_declarations/weak_include_strict.phpt
@@ -11,7 +11,7 @@ require 'weak_include_strict_2.inc';
// calls within that file should stay strict, despite being included by weak file
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to takes_int() must be of the type int, float given, called in %sweak_include_strict_2.inc on line 9 and defined in %sweak_include_strict_2.inc:5
+Fatal error: Uncaught TypeError: takes_int(): Argument #1 ($x) must be of type int, float given, called in %s:%d
Stack trace:
#0 %s(%d): takes_int(1)
#1 %s(%d): require('%s')
diff --git a/Zend/tests/typehints/bug76198.phpt b/Zend/tests/typehints/bug76198.phpt
index fcaefbbec3..8d71d02461 100644
--- a/Zend/tests/typehints/bug76198.phpt
+++ b/Zend/tests/typehints/bug76198.phpt
@@ -4,7 +4,7 @@
<?php
function foo(): \iterable {
- return [];
+ return [];
}
var_dump(foo());
diff --git a/Zend/tests/typehints/fully_qualified_scalar.phpt b/Zend/tests/typehints/fully_qualified_scalar.phpt
index 84c9dee636..9fdfcb901c 100644
--- a/Zend/tests/typehints/fully_qualified_scalar.phpt
+++ b/Zend/tests/typehints/fully_qualified_scalar.phpt
@@ -4,7 +4,7 @@ Fully qualified (leading backslash) type names must fail
<?php
function foo(\int $foo) {
- var_dump($foo);
+ var_dump($foo);
}
foo(1);
diff --git a/Zend/tests/typehints/or_null.phpt b/Zend/tests/typehints/or_null.phpt
index 552db7d058..d7a2e23002 100644
--- a/Zend/tests/typehints/or_null.phpt
+++ b/Zend/tests/typehints/or_null.phpt
@@ -219,99 +219,99 @@ try {
?>
--EXPECTF--
-TypeError: Argument 1 passed to unloadedClass() must be an instance of I\Dont\Exist or null, instance of stdClass given, called in %s on line 8 and defined in %s:5
+TypeError: unloadedClass(): Argument #1 ($param) must be of type ?I\Dont\Exist, stdClass given, called in %s:%d
Stack trace:
#0 %s(8): unloadedClass(Object(stdClass))
#1 {main}
-TypeError: Argument 1 passed to loadedClass() must be an instance of RealClass or null, instance of stdClass given, called in %s on line 20 and defined in %s:16
+TypeError: loadedClass(): Argument #1 ($param) must be of type ?RealClass, stdClass given, called in %s:%d
Stack trace:
#0 %s(20): loadedClass(Object(stdClass))
#1 {main}
-TypeError: Argument 1 passed to loadedInterface() must implement interface RealInterface or be null, instance of stdClass given, called in %s on line 26 and defined in %s:17
+TypeError: loadedInterface(): Argument #1 ($param) must be of type ?RealInterface, stdClass given, called in %s:%d
Stack trace:
#0 %s(26): loadedInterface(Object(stdClass))
#1 {main}
-TypeError: Argument 1 passed to unloadedClass() must be an instance of I\Dont\Exist or null, int given, called in %s on line 32 and defined in %s:5
+TypeError: unloadedClass(): Argument #1 ($param) must be of type ?I\Dont\Exist, int given, called in %s:%d
Stack trace:
#0 %s(32): unloadedClass(1)
#1 {main}
-TypeError: Argument 1 passed to loadedClass() must be an instance of RealClass or null, int given, called in %s on line 38 and defined in %s:16
+TypeError: loadedClass(): Argument #1 ($param) must be of type ?RealClass, int given, called in %s:%d
Stack trace:
#0 %s(38): loadedClass(1)
#1 {main}
-TypeError: Argument 1 passed to loadedInterface() must implement interface RealInterface or be null, int given, called in %s on line 44 and defined in %s:17
+TypeError: loadedInterface(): Argument #1 ($param) must be of type ?RealInterface, int given, called in %s:%d
Stack trace:
#0 %s(44): loadedInterface(1)
#1 {main}
-TypeError: Argument 1 passed to callableF() must be callable or null, int given, called in %s on line 52 and defined in %s:49
+TypeError: callableF(): Argument #1 ($param) must be of type ?callable, int given, called in %s:%d
Stack trace:
#0 %s(52): callableF(1)
#1 {main}
-TypeError: Argument 1 passed to iterableF() must be iterable or null, int given, called in %s on line 60 and defined in %s:57
+TypeError: iterableF(): Argument #1 ($param) must be of type ?iterable, int given, called in %s:%d
Stack trace:
#0 %s(60): iterableF(1)
#1 {main}
-TypeError: Argument 1 passed to intF() must be of the type int or null, object given, called in %s on line 68 and defined in %s:65
+TypeError: intF(): Argument #1 ($param) must be of type ?int, stdClass given, called in %s:%d
Stack trace:
#0 %s(68): intF(Object(stdClass))
#1 {main}
-TypeError: Return value of returnUnloadedClass() must be an instance of I\Dont\Exist or null, instance of stdClass returned in %s:74
+TypeError: returnUnloadedClass(): Return value must be of type ?I\Dont\Exist, stdClass returned in %s:%d
Stack trace:
#0 %s(78): returnUnloadedClass()
#1 {main}
-TypeError: Return value of returnLoadedClass() must be an instance of RealClass or null, instance of stdClass returned in %s:84
+TypeError: returnLoadedClass(): Return value must be of type ?RealClass, stdClass returned in %s:%d
Stack trace:
#0 %s(88): returnLoadedClass()
#1 {main}
-TypeError: Return value of returnLoadedInterface() must implement interface RealInterface or be null, instance of stdClass returned in %s:94
+TypeError: returnLoadedInterface(): Return value must be of type ?RealInterface, stdClass returned in %s:%d
Stack trace:
#0 %s(98): returnLoadedInterface()
#1 {main}
-TypeError: Return value of returnUnloadedClassScalar() must be an instance of I\Dont\Exist or null, int returned in %s:104
+TypeError: returnUnloadedClassScalar(): Return value must be of type ?I\Dont\Exist, int returned in %s:%d
Stack trace:
#0 %s(108): returnUnloadedClassScalar()
#1 {main}
-TypeError: Return value of returnLoadedClassScalar() must be an instance of RealClass or null, int returned in %s:114
+TypeError: returnLoadedClassScalar(): Return value must be of type ?RealClass, int returned in %s:%d
Stack trace:
#0 %s(118): returnLoadedClassScalar()
#1 {main}
-TypeError: Return value of returnLoadedInterfaceScalar() must implement interface RealInterface or be null, int returned in %s:124
+TypeError: returnLoadedInterfaceScalar(): Return value must be of type ?RealInterface, int returned in %s:%d
Stack trace:
#0 %s(128): returnLoadedInterfaceScalar()
#1 {main}
-TypeError: Return value of returnCallable() must be callable or null, int returned in %s:134
+TypeError: returnCallable(): Return value must be of type ?callable, int returned in %s:%d
Stack trace:
#0 %s(138): returnCallable()
#1 {main}
-TypeError: Return value of returnIterable() must be iterable or null, int returned in %s:144
+TypeError: returnIterable(): Return value must be of type ?iterable, int returned in %s:%d
Stack trace:
#0 %s(148): returnIterable()
#1 {main}
-TypeError: Return value of returnInt() must be of the type int or null, object returned in %s:154
+TypeError: returnInt(): Return value must be of type ?int, stdClass returned in %s:%d
Stack trace:
#0 %s(158): returnInt()
#1 {main}
-TypeError: Return value of returnMissingUnloadedClass() must be an instance of I\Dont\Exist or null, none returned in %s:164
+TypeError: returnMissingUnloadedClass(): Return value must be of type ?I\Dont\Exist, none returned in %s:%d
Stack trace:
#0 %s(167): returnMissingUnloadedClass()
#1 {main}
-TypeError: Return value of returnMissingLoadedClass() must be an instance of RealClass or null, none returned in %s:173
+TypeError: returnMissingLoadedClass(): Return value must be of type ?RealClass, none returned in %s:%d
Stack trace:
#0 %s(176): returnMissingLoadedClass()
#1 {main}
-TypeError: Return value of returnMissingLoadedInterface() must implement interface RealInterface or be null, none returned in %s:182
+TypeError: returnMissingLoadedInterface(): Return value must be of type ?RealInterface, none returned in %s:%d
Stack trace:
#0 %s(185): returnMissingLoadedInterface()
#1 {main}
-TypeError: Return value of returnMissingCallable() must be callable or null, none returned in %s:191
+TypeError: returnMissingCallable(): Return value must be of type ?callable, none returned in %s:%d
Stack trace:
#0 %s(194): returnMissingCallable()
#1 {main}
-TypeError: Return value of returnMissingIterable() must be iterable or null, none returned in %s:200
+TypeError: returnMissingIterable(): Return value must be of type ?iterable, none returned in %s:%d
Stack trace:
#0 %s(203): returnMissingIterable()
#1 {main}
-TypeError: Return value of returnMissingInt() must be of the type int or null, none returned in %s:209
+TypeError: returnMissingInt(): Return value must be of type ?int, none returned in %s:%d
Stack trace:
#0 %s(212): returnMissingInt()
#1 {main}
diff --git a/Zend/tests/undef_index_to_exception.phpt b/Zend/tests/undef_index_to_exception.phpt
index d113608a5e..c01aaba658 100644
--- a/Zend/tests/undef_index_to_exception.phpt
+++ b/Zend/tests/undef_index_to_exception.phpt
@@ -36,11 +36,11 @@ try {
?>
--EXPECT--
-Undefined offset: 0
+Undefined array key 0
array(0) {
}
-Undefined index: key
+Undefined array key "key"
array(0) {
}
-Undefined index: test
-Undefined variable: test
+Undefined array key "test"
+Undefined variable $test
diff --git a/Zend/tests/undef_var_in_verify_return.phpt b/Zend/tests/undef_var_in_verify_return.phpt
new file mode 100644
index 0000000000..b8c263c424
--- /dev/null
+++ b/Zend/tests/undef_var_in_verify_return.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Throwing undef var in verify return
+--FILE--
+<?php
+
+set_error_handler(function(int $severity, string $message, string $filename, int $lineNumber): void {
+ throw new ErrorException($message, 0, $severity, $filename, $lineNumber);
+});
+
+function test(): string {
+ return $test;
+}
+
+test();
+
+?>
+--EXPECTF--
+Fatal error: Uncaught ErrorException: Undefined variable $test in %s:%d
+Stack trace:
+#0 %s(%d): {closure}(2, 'Undefined varia...', '%s', 8)
+#1 %s(%d): test()
+#2 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/unexpected_ref_bug.phpt b/Zend/tests/unexpected_ref_bug.phpt
index a4e74e7a67..172b1e6224 100644
--- a/Zend/tests/unexpected_ref_bug.phpt
+++ b/Zend/tests/unexpected_ref_bug.phpt
@@ -9,12 +9,11 @@ class Test {
return ",";
}
}
-$my_var = str_repeat("A",64);
-$data = call_user_func_array("explode",array(new Test(), &$my_var));
-$my_var=array(1,2,3);
-$data = call_user_func_array("implode",array(&$my_var, new Test()));
+$my_var = str_repeat("A", 64);
+$data = call_user_func_array("explode", array(new Test(), &$my_var));
+$my_var = str_repeat("A", 64);
+$data = call_user_func_array("str_replace", array(&$my_var, new Test(), "foo"));
echo "Done.\n";
?>
---EXPECTF--
-Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
+--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..55dac22e50 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..8e42005db3 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..87f04d50ca 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..e746059727 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_cv06.phpt b/Zend/tests/unset_cv06.phpt
index 073a3007f9..d4f3852658 100644
--- a/Zend/tests/unset_cv06.phpt
+++ b/Zend/tests/unset_cv06.phpt
@@ -18,5 +18,5 @@ echo "ok\n";
--EXPECTF--
1
-Notice: Undefined index: x in %sunset_cv06.php on line %d
+Warning: Undefined array key "x" in %s on line %d
ok
diff --git a/Zend/tests/unset_cv09.phpt b/Zend/tests/unset_cv09.phpt
index a5407ad64e..63a7eab0f2 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..c62b8ae57a 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/unterminated_comment.phpt b/Zend/tests/unterminated_comment.phpt
new file mode 100644
index 0000000000..8a0fb34a2a
--- /dev/null
+++ b/Zend/tests/unterminated_comment.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Unterminated comment
+--FILE--
+<?php
+/* Foo
+Bar
+--EXPECTF--
+Parse error: Unterminated comment starting line 2 in %s on line %d
diff --git a/Zend/tests/use_const/no_global_fallback.phpt b/Zend/tests/use_const/no_global_fallback.phpt
index f9ee605515..d6f9265607 100644
--- a/Zend/tests/use_const/no_global_fallback.phpt
+++ b/Zend/tests/use_const/no_global_fallback.phpt
@@ -10,7 +10,7 @@ var_dump(baz);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Undefined constant 'foo\bar\baz' in %s:%d
+Fatal error: Uncaught Error: Undefined constant "foo\bar\baz" in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/use_function/no_global_fallback2.phpt b/Zend/tests/use_function/no_global_fallback2.phpt
index cf6026f56a..515c2e97ac 100644
--- a/Zend/tests/use_function/no_global_fallback2.phpt
+++ b/Zend/tests/use_function/no_global_fallback2.phpt
@@ -4,13 +4,13 @@ non-existent imported functions should not be looked up in the global table
<?php
namespace {
- function test() {
- echo "NO!";
- }
+ function test() {
+ echo "NO!";
+ }
}
namespace foo {
- use function bar\test;
- test();
+ use function bar\test;
+ test();
}
?>
diff --git a/Zend/tests/use_unlinked_class.phpt b/Zend/tests/use_unlinked_class.phpt
index e85f97821f..17e12418db 100644
--- a/Zend/tests/use_unlinked_class.phpt
+++ b/Zend/tests/use_unlinked_class.phpt
@@ -12,10 +12,9 @@ class A implements I {
?>
--EXPECTF--
-Fatal error: Uncaught ReflectionException: Class A does not exist in %s:%d
+Fatal error: Uncaught ReflectionException: Class "A" does not exist in %s:%d
Stack trace:
#0 %s(%d): ReflectionClass->__construct('A')
-#1 [internal function]: {closure}('I')
-#2 %s(%d): spl_autoload_call('I')
-#3 {main}
+#1 %s(%d): {closure}('I')
+#2 {main}
thrown in %s on line %d
diff --git a/Zend/tests/varSyntax/class_constant_static_deref.phpt b/Zend/tests/varSyntax/class_constant_static_deref.phpt
new file mode 100644
index 0000000000..7585a30dc0
--- /dev/null
+++ b/Zend/tests/varSyntax/class_constant_static_deref.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Class constants can be used as a class name
+--FILE--
+<?php
+
+class Test {
+ const NAME = 'Test2';
+}
+
+class Test2 {
+ const FOO = 42;
+ public static $foo = 42;
+
+ public static function foo() {
+ return 42;
+ }
+}
+
+var_dump(Test::NAME::FOO);
+var_dump(Test::NAME::$foo);
+var_dump(Test::NAME::foo());
+
+?>
+--EXPECT--
+int(42)
+int(42)
+int(42)
diff --git a/Zend/tests/varSyntax/constant_object_deref.phpt b/Zend/tests/varSyntax/constant_object_deref.phpt
new file mode 100644
index 0000000000..b25d655744
--- /dev/null
+++ b/Zend/tests/varSyntax/constant_object_deref.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Constants can be dereferenced as objects (even though they can't be objects)
+--FILE--
+<?php
+
+const FOO = "foo";
+class Bar { const FOO = "foo"; }
+
+try {
+ FOO->length();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ Bar::FOO->length();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Call to a member function length() on string
+Call to a member function length() on string
diff --git a/Zend/tests/varSyntax/encapsed_string_deref.phpt b/Zend/tests/varSyntax/encapsed_string_deref.phpt
new file mode 100644
index 0000000000..386e15932e
--- /dev/null
+++ b/Zend/tests/varSyntax/encapsed_string_deref.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Dereferencing operations on an encapsed string
+--FILE--
+<?php
+
+$bar = "bar";
+var_dump("foo$bar"[0]);
+var_dump("foo$bar"->prop);
+try {
+ var_dump("foo$bar"->method());
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+class FooBar { public static $prop = 42; }
+var_dump("foo$bar"::$prop);
+
+function foobar() { return 42; }
+var_dump("foo$bar"());
+
+?>
+--EXPECTF--
+string(1) "f"
+
+Warning: Attempt to read property "prop" on string in %s on line %d
+NULL
+Call to a member function method() on string
+int(42)
+int(42)
diff --git a/Zend/tests/varSyntax/globalNonSimpleVariableError.phpt b/Zend/tests/varSyntax/globalNonSimpleVariableError.phpt
index 6847c6f2ea..f41840cbb3 100644
--- a/Zend/tests/varSyntax/globalNonSimpleVariableError.phpt
+++ b/Zend/tests/varSyntax/globalNonSimpleVariableError.phpt
@@ -7,4 +7,4 @@ global $$foo->bar;
?>
--EXPECTF--
-Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ';' or ',' in %s on line %d
+Parse error: syntax error, unexpected token "->", expecting "," or ";" in %s on line %d
diff --git a/Zend/tests/varSyntax/magic_const_deref.phpt b/Zend/tests/varSyntax/magic_const_deref.phpt
new file mode 100644
index 0000000000..54a5c95069
--- /dev/null
+++ b/Zend/tests/varSyntax/magic_const_deref.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Dereferencing of magic constants
+--FILE--
+<?php
+
+function test() {
+ var_dump(__FUNCTION__[0]);
+ var_dump(__FUNCTION__->prop);
+ try {
+ __FUNCTION__->method();
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+}
+
+test();
+
+?>
+--EXPECTF--
+string(1) "t"
+
+Warning: Attempt to read property "prop" on string in %s on line %d
+NULL
+Call to a member function method() on string
diff --git a/Zend/tests/varSyntax/newVariable.phpt b/Zend/tests/varSyntax/newVariable.phpt
index 5505ffc0f1..97927ef439 100644
--- a/Zend/tests/varSyntax/newVariable.phpt
+++ b/Zend/tests/varSyntax/newVariable.phpt
@@ -15,7 +15,6 @@ $weird = [0 => (object) ['foo' => 'Test']];
var_dump(new $className);
var_dump(new $array['className']);
-var_dump(new $array{'className'});
var_dump(new $obj->className);
var_dump(new Test::$className);
var_dump(new $test::$className);
@@ -23,9 +22,6 @@ var_dump(new $weird[0]->foo::$className);
?>
--EXPECTF--
-Deprecated: Array and string offset access syntax with curly braces is deprecated in %s on line %d
-object(stdClass)#%d (0) {
-}
object(stdClass)#%d (0) {
}
object(stdClass)#%d (0) {
diff --git a/Zend/tests/varSyntax/new_instanceof_expr.phpt b/Zend/tests/varSyntax/new_instanceof_expr.phpt
new file mode 100644
index 0000000000..475f7a9dae
--- /dev/null
+++ b/Zend/tests/varSyntax/new_instanceof_expr.phpt
@@ -0,0 +1,18 @@
+--TEST--
+new with an arbitrary expression
+--FILE--
+<?php
+
+$class = 'class';
+var_dump(new ('std'.$class));
+var_dump(new ('std'.$class)());
+$obj = new stdClass;
+var_dump($obj instanceof ('std'.$class));
+
+?>
+--EXPECT--
+object(stdClass)#1 (0) {
+}
+object(stdClass)#1 (0) {
+}
+bool(true)
diff --git a/Zend/tests/varSyntax/propertyOfStringError.phpt b/Zend/tests/varSyntax/propertyOfStringError.phpt
index 4fa50e7df0..b0658faa7a 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: Attempt to read property "bar" on string in %s on line %d
diff --git a/Zend/tests/variadic/adding_additional_optional_parameter_error.phpt b/Zend/tests/variadic/adding_additional_optional_parameter_error.phpt
index 4c6f36f10b..a04cd84f5e 100644
--- a/Zend/tests/variadic/adding_additional_optional_parameter_error.phpt
+++ b/Zend/tests/variadic/adding_additional_optional_parameter_error.phpt
@@ -13,4 +13,4 @@ class MySQL implements DB {
?>
--EXPECTF--
-Fatal error: Declaration of MySQL::query($query, ?int $extraParam = NULL, string ...$params) must be compatible with DB::query($query, string ...$params) in %s on line %d
+Fatal error: Declaration of MySQL::query($query, ?int $extraParam = null, string ...$params) must be compatible with DB::query($query, string ...$params) in %s on line %d
diff --git a/Zend/tests/variadic/by_ref_error.phpt b/Zend/tests/variadic/by_ref_error.phpt
index 7f21014146..3c1e37a3ac 100644
--- a/Zend/tests/variadic/by_ref_error.phpt
+++ b/Zend/tests/variadic/by_ref_error.phpt
@@ -9,4 +9,7 @@ test(1);
?>
--EXPECTF--
-Fatal error: Only variables can be passed by reference in %s on line %d
+Fatal error: Uncaught Error: test(): Argument #1 cannot be passed by reference in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/variadic/illegal_variadic_override_ref.phpt b/Zend/tests/variadic/illegal_variadic_override_ref.phpt
new file mode 100644
index 0000000000..fb6475835a
--- /dev/null
+++ b/Zend/tests/variadic/illegal_variadic_override_ref.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Illegal variadic inheritance due to reference mismatch
+--FILE--
+<?php
+
+class A {
+ public function test(&$a, &$b) {}
+}
+
+class B extends A {
+ public function test(...$args) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of B::test(...$args) must be compatible with A::test(&$a, &$b) in %s on line %d
diff --git a/Zend/tests/variadic/illegal_variadic_override_type.phpt b/Zend/tests/variadic/illegal_variadic_override_type.phpt
new file mode 100644
index 0000000000..6417029a29
--- /dev/null
+++ b/Zend/tests/variadic/illegal_variadic_override_type.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Illegal variadic inheritance due to type mismatch
+--FILE--
+<?php
+
+class A {
+ public function test(int $a, int $b) {}
+}
+
+class B extends A {
+ public function test(string ...$args) {}
+}
+
+?>
+--EXPECTF--
+Fatal error: Declaration of B::test(string ...$args) must be compatible with A::test(int $a, int $b) in %s on line %d
diff --git a/Zend/tests/variadic/legal_variadic_override.phpt b/Zend/tests/variadic/legal_variadic_override.phpt
new file mode 100644
index 0000000000..030c65e899
--- /dev/null
+++ b/Zend/tests/variadic/legal_variadic_override.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Cases where non-variadic parameters are allowed to be subsumed by a variadic one
+--FILE--
+<?php
+
+class A {
+ public function test1($a, $b) {}
+ public function test2(int $a, int $b) {}
+ public function test3(int $a, int $b) {}
+ public function test4(int $a, string $b) {}
+ public function test5(&$a, &$b) {}
+}
+
+class B extends A {
+ public function test1(...$args) {}
+ public function test2(...$args) {}
+ public function test3(int ...$args) {}
+ public function test4(int|string ...$args) {}
+ public function test5(&...$args) {}
+}
+
+?>
+===DONE==
+--EXPECT--
+===DONE==
diff --git a/Zend/tests/variadic/optional_params.phpt b/Zend/tests/variadic/optional_params.phpt
index ba800032d7..2c93d67151 100644
--- a/Zend/tests/variadic/optional_params.phpt
+++ b/Zend/tests/variadic/optional_params.phpt
@@ -6,7 +6,7 @@ Optional parameter before variadic parameter
function f($reqParam, $optParam = null, ...$params) {
var_dump($reqParam, $optParam, $params);
}
-
+
f(1);
f(1, 2);
f(1, 2, 3);
diff --git a/Zend/tests/variadic/removing_parameter_error.phpt b/Zend/tests/variadic/removing_parameter_error.phpt
index cf483c7fec..0c66c1547d 100644
--- a/Zend/tests/variadic/removing_parameter_error.phpt
+++ b/Zend/tests/variadic/removing_parameter_error.phpt
@@ -1,12 +1,8 @@
--TEST--
-It's not possible to remove required parameter before a variadic parameter
+It is possible to remove required parameter before a variadic parameter
--FILE--
<?php
-/* Theoretically this should be valid because it weakens the constraint, but
- * PHP does not allow this (for non-variadics), so I'm not allowing it here, too,
- * to stay consistent. */
-
interface DB {
public function query($query, ...$params);
}
@@ -16,5 +12,6 @@ class MySQL implements DB {
}
?>
---EXPECTF--
-Fatal error: Declaration of MySQL::query(...$params) must be compatible with DB::query($query, ...$params) in %s on line %d
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/tests/variadic/typehint_error.phpt b/Zend/tests/variadic/typehint_error.phpt
index d9a5ea291f..224d2e2b1f 100644
--- a/Zend/tests/variadic/typehint_error.phpt
+++ b/Zend/tests/variadic/typehint_error.phpt
@@ -33,7 +33,7 @@ array(3) {
}
}
-Fatal error: Uncaught TypeError: Argument 3 passed to test() must be of the type array, int given, called in %s:%d
+Fatal error: Uncaught TypeError: test(): Argument #3 must be of type array, int given, called in %s:%d
Stack trace:
#0 %s(%d): test(Array, Array, 2)
#1 {main}
diff --git a/Zend/tests/variadic/typehint_suppressed_error.phpt b/Zend/tests/variadic/typehint_suppressed_error.phpt
index ebc44c38b1..7cbc02bf58 100644
--- a/Zend/tests/variadic/typehint_suppressed_error.phpt
+++ b/Zend/tests/variadic/typehint_suppressed_error.phpt
@@ -8,11 +8,11 @@ function test(array... $args) {
}
try {
- test([0], [1], 2);
+ test([0], [1], 2);
} catch(Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
--EXPECTF--
-string(%d) "Argument 3 passed to test() must be of the type array, int given, called in %s on line %d"
+string(%d) "test(): Argument #3 must be of type array, int given, called in %s on line %d"
diff --git a/Zend/tests/vm_stack_with_arg_extend.phpt b/Zend/tests/vm_stack_with_arg_extend.phpt
index 10f3639d21..49f1f5b5c1 100644
--- a/Zend/tests/vm_stack_with_arg_extend.phpt
+++ b/Zend/tests/vm_stack_with_arg_extend.phpt
@@ -4,12 +4,12 @@ Ensure valid vm_stack even when it needed to be copied to a new page
<?php
function f(...$args) {
- var_dump(count($args));
+ var_dump(count($args));
}
(function(){
- $a = array_fill(0, 1024, true);
- f(...$a);
- yield;
+ $a = array_fill(0, 1024, true);
+ f(...$a);
+ yield;
})()->valid();
?>
diff --git a/Zend/tests/warning_during_heredoc_scan_ahead.phpt b/Zend/tests/warning_during_heredoc_scan_ahead.phpt
index c252be1f4f..7def8a4554 100644
--- a/Zend/tests/warning_during_heredoc_scan_ahead.phpt
+++ b/Zend/tests/warning_during_heredoc_scan_ahead.phpt
@@ -4,20 +4,14 @@ No warnings should be thrown during heredoc scan-ahead
<?php
<<<TEST
-${x}
\400
${"\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: 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
-
-Parse error: syntax error, unexpected end of file in %s on line %d
+Warning: Undefined variable $ in %s on line %d
diff --git a/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt b/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt
new file mode 100644
index 0000000000..dd3c84518e
--- /dev/null
+++ b/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Basic WeakMap behavior (as a map)
+--FILE--
+<?php
+
+$map = new WeakMap;
+var_dump(count($map));
+
+$obj = new stdClass;
+$obj->value = 1;
+$obj2 = new stdClass;
+$obj2->value = 2;
+
+$map[$obj] = $obj2;
+var_dump(count($map));
+var_dump($map);
+var_dump(isset($map[$obj]));
+var_dump(!empty($map[$obj]));
+var_dump($map[$obj]);
+
+$map[$obj] = 42;
+var_dump($map);
+var_dump(isset($map[$obj]));
+var_dump(!empty($map[$obj]));
+var_dump($map[$obj]);
+
+$map[$obj] = false;
+var_dump($map);
+var_dump(isset($map[$obj]));
+var_dump(!empty($map[$obj]));
+var_dump($map[$obj]);
+
+$map[$obj] = null;
+var_dump($map);
+var_dump(isset($map[$obj]));
+var_dump(!empty($map[$obj]));
+var_dump($map[$obj]);
+
+unset($map[$obj]);
+var_dump($map);
+var_dump(isset($map[$obj]));
+var_dump(!empty($map[$obj]));
+try {
+ var_dump($map[$obj]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+// It's okay to unset an object that's not in the map.
+unset($map[new stdClass]);
+
+echo "\nIndirect modification:\n";
+$map[$obj] = [];
+$map[$obj][] = 42;
+$map[$obj2] = 41;
+$map[$obj2]++;
+var_dump($map);
+
+echo "\nMethods:\n";
+var_dump($map->offsetSet($obj2, 43));
+var_dump($map->offsetGet($obj2));
+var_dump($map->offsetExists($obj2));
+var_dump($map->count());
+var_dump($map->offsetUnset($obj2));
+var_dump($map->count());
+
+?>
+--EXPECT--
+int(0)
+int(1)
+object(WeakMap)#1 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#2 (1) {
+ ["value"]=>
+ int(1)
+ }
+ ["value"]=>
+ object(stdClass)#3 (1) {
+ ["value"]=>
+ int(2)
+ }
+ }
+}
+bool(true)
+bool(true)
+object(stdClass)#3 (1) {
+ ["value"]=>
+ int(2)
+}
+object(WeakMap)#1 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#2 (1) {
+ ["value"]=>
+ int(1)
+ }
+ ["value"]=>
+ int(42)
+ }
+}
+bool(true)
+bool(true)
+int(42)
+object(WeakMap)#1 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#2 (1) {
+ ["value"]=>
+ int(1)
+ }
+ ["value"]=>
+ bool(false)
+ }
+}
+bool(true)
+bool(false)
+bool(false)
+object(WeakMap)#1 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#2 (1) {
+ ["value"]=>
+ int(1)
+ }
+ ["value"]=>
+ NULL
+ }
+}
+bool(false)
+bool(false)
+NULL
+object(WeakMap)#1 (0) {
+}
+bool(false)
+bool(false)
+Object stdClass#2 not contained in WeakMap
+
+Indirect modification:
+object(WeakMap)#1 (2) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#2 (1) {
+ ["value"]=>
+ int(1)
+ }
+ ["value"]=>
+ array(1) {
+ [0]=>
+ int(42)
+ }
+ }
+ [1]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#3 (1) {
+ ["value"]=>
+ int(2)
+ }
+ ["value"]=>
+ int(42)
+ }
+}
+
+Methods:
+NULL
+int(43)
+bool(true)
+int(2)
+NULL
+int(1)
diff --git a/Zend/tests/weakrefs/weakmap_error_conditions.phpt b/Zend/tests/weakrefs/weakmap_error_conditions.phpt
new file mode 100644
index 0000000000..2516c0443f
--- /dev/null
+++ b/Zend/tests/weakrefs/weakmap_error_conditions.phpt
@@ -0,0 +1,92 @@
+--TEST--
+WeakMap error conditions
+--FILE--
+<?php
+
+$map = new WeakMap;
+try {
+ $map[1] = 2;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($map[1]);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ isset($map[1]);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ unset($map[1]);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ $map[] = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $map[][1] = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($map[new stdClass]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+var_dump($map->prop);
+var_dump(isset($map->prop));
+unset($map->prop);
+
+try {
+ $map->prop = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $map->prop[] = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $r =& $map->prop;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ serialize($map);
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ unserialize('C:7:"WeakMap":0:{}');
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECTF--
+WeakMap key must be an object
+WeakMap key must be an object
+WeakMap key must be an object
+WeakMap key must be an object
+Cannot append to WeakMap
+Cannot append to WeakMap
+Object stdClass#2 not contained in WeakMap
+
+Warning: Undefined property: WeakMap::$prop in %s on line %d
+NULL
+bool(false)
+Cannot create dynamic property WeakMap::$prop
+Cannot create dynamic property WeakMap::$prop
+Cannot create dynamic property WeakMap::$prop
+Serialization of 'WeakMap' is not allowed
+Unserialization of 'WeakMap' is not allowed
diff --git a/Zend/tests/weakrefs/weakmap_iteration.phpt b/Zend/tests/weakrefs/weakmap_iteration.phpt
new file mode 100644
index 0000000000..1d1f6def8f
--- /dev/null
+++ b/Zend/tests/weakrefs/weakmap_iteration.phpt
@@ -0,0 +1,80 @@
+--TEST--
+WeakMap iteration
+--FILE--
+<?php
+
+$map = new WeakMap;
+
+echo "\nEmpty loop:\n";
+foreach ($map as $key => $value) {
+ var_dump($key, $value);
+}
+
+echo "\nSimple loop:\n";
+$obj0 = new stdClass;
+$obj1 = new stdClass;
+$obj2 = new stdClass;
+$map[$obj0] = 0;
+$map[$obj1] = 1;
+$map[$obj2] = 2;
+foreach ($map as $key => $value) {
+ var_dump($key, $value);
+}
+
+echo "\nObject removed during loop:\n";
+foreach ($map as $key => $value) {
+ if (isset($obj1) && $key === $obj1) unset($obj1);
+ var_dump($key, $value);
+}
+
+echo "\nBy reference iteration:\n";
+foreach ($map as $key => &$value) {
+ $value++;
+}
+var_dump($map);
+
+?>
+--EXPECT--
+Empty loop:
+
+Simple loop:
+object(stdClass)#2 (0) {
+}
+int(0)
+object(stdClass)#3 (0) {
+}
+int(1)
+object(stdClass)#4 (0) {
+}
+int(2)
+
+Object removed during loop:
+object(stdClass)#2 (0) {
+}
+int(0)
+object(stdClass)#3 (0) {
+}
+int(1)
+object(stdClass)#4 (0) {
+}
+int(2)
+
+By reference iteration:
+object(WeakMap)#1 (2) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#2 (0) {
+ }
+ ["value"]=>
+ &int(1)
+ }
+ [1]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#4 (0) {
+ }
+ ["value"]=>
+ &int(3)
+ }
+}
diff --git a/Zend/tests/weakrefs/weakmap_multiple_weakrefs.phpt b/Zend/tests/weakrefs/weakmap_multiple_weakrefs.phpt
new file mode 100644
index 0000000000..c3a1edaf05
--- /dev/null
+++ b/Zend/tests/weakrefs/weakmap_multiple_weakrefs.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Multiple WeakMaps / WeakRefs on the same object
+--FILE--
+<?php
+
+$obj = new stdClass;
+
+$ref = WeakReference::create($obj);
+$map = new WeakMap;
+$map[$obj] = 1;
+$map2 = new WeakMap;
+$map2[$obj] = 1;
+$map3 = clone $map2;
+
+var_dump($ref->get(), $map, $map2, $map3);
+unset($obj);
+var_dump($ref->get(), $map, $map2, $map3);
+unset($ref, $map, $map2);
+
+$obj = new stdClass;
+$ref = WeakReference::create($obj);
+$map = new WeakMap;
+$map[$obj] = 1;
+$map2 = new WeakMap;
+$map2[$obj] = 1;
+$map3 = clone $map2;
+
+unset($ref, $map, $map2, $map3);
+var_dump($obj);
+unset($obj);
+
+?>
+--EXPECT--
+object(stdClass)#1 (0) {
+}
+object(WeakMap)#3 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#1 (0) {
+ }
+ ["value"]=>
+ int(1)
+ }
+}
+object(WeakMap)#4 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#1 (0) {
+ }
+ ["value"]=>
+ int(1)
+ }
+}
+object(WeakMap)#5 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#1 (0) {
+ }
+ ["value"]=>
+ int(1)
+ }
+}
+NULL
+object(WeakMap)#3 (0) {
+}
+object(WeakMap)#4 (0) {
+}
+object(WeakMap)#5 (0) {
+}
+object(stdClass)#4 (0) {
+}
diff --git a/Zend/tests/weakrefs/weakmap_weakness.phpt b/Zend/tests/weakrefs/weakmap_weakness.phpt
new file mode 100644
index 0000000000..d740d2b219
--- /dev/null
+++ b/Zend/tests/weakrefs/weakmap_weakness.phpt
@@ -0,0 +1,128 @@
+--TEST--
+The weak part of the WeakMap
+--FILE--
+<?php
+
+$map = new WeakMap;
+
+// This is doing to be inserted into the map and immediately removed again
+$map[new stdClass] = 1;
+var_dump($map);
+
+$obj = new stdClass;
+$map[$obj] = 2;
+var_dump($map);
+
+unset($obj);
+var_dump($map);
+
+echo "\nDestructor in WeakMap value:\n";
+$obj = new stdClass;
+$map[$obj] = new class {
+ public function __destruct() {
+ echo "Dtor!\n";
+ }
+};
+
+echo "Before unset:\n";
+unset($obj);
+echo "After unset:\n";
+var_dump($map);
+
+echo "\nDestroying map with live object:\n";
+$obj = new stdClass;
+$map[$obj] = 3;
+unset($map);
+var_dump($obj);
+
+echo "\nObject freed by GC:\n";
+$map = new WeakMap;
+$obj = new stdClass;
+$obj->obj = $obj;
+$map[$obj] = 4;
+unset($obj);
+var_dump($map);
+gc_collect_cycles();
+var_dump($map);
+
+echo "\nStoring object as own value:\n";
+$map = new WeakMap;
+$obj = new stdClass;
+$map[$obj] = $obj;
+unset($obj);
+var_dump($map);
+unset($map);
+
+echo "\nStoring map in itself:\n";
+$map = new WeakMap;
+$map[$map] = $map;
+var_dump($map);
+unset($map);
+
+?>
+--EXPECT--
+object(WeakMap)#1 (0) {
+}
+object(WeakMap)#1 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#2 (0) {
+ }
+ ["value"]=>
+ int(2)
+ }
+}
+object(WeakMap)#1 (0) {
+}
+
+Destructor in WeakMap value:
+Before unset:
+Dtor!
+After unset:
+object(WeakMap)#1 (0) {
+}
+
+Destroying map with live object:
+object(stdClass)#2 (0) {
+}
+
+Object freed by GC:
+object(WeakMap)#1 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#3 (1) {
+ ["obj"]=>
+ *RECURSION*
+ }
+ ["value"]=>
+ int(4)
+ }
+}
+object(WeakMap)#1 (0) {
+}
+
+Storing object as own value:
+object(WeakMap)#3 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ object(stdClass)#1 (0) {
+ }
+ ["value"]=>
+ object(stdClass)#1 (0) {
+ }
+ }
+}
+
+Storing map in itself:
+object(WeakMap)#3 (1) {
+ [0]=>
+ array(2) {
+ ["key"]=>
+ *RECURSION*
+ ["value"]=>
+ *RECURSION*
+ }
+}
diff --git a/Zend/tests/weakrefs/weakrefs_002.phpt b/Zend/tests/weakrefs/weakrefs_002.phpt
index a2e277f98d..f550302aec 100644
--- a/Zend/tests/weakrefs/weakrefs_002.phpt
+++ b/Zend/tests/weakrefs/weakrefs_002.phpt
@@ -5,9 +5,9 @@ WeakReference serials
$wr = WeakReference::create(new stdClass);
try {
- serialize($wr);
+ serialize($wr);
} catch (Exception $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
$wrs = 'O:13:"WeakReference":0:{}';
diff --git a/Zend/tests/weakrefs/weakrefs_003.phpt b/Zend/tests/weakrefs/weakrefs_003.phpt
index e7d8e281c5..42fe0560a7 100644
--- a/Zend/tests/weakrefs/weakrefs_003.phpt
+++ b/Zend/tests/weakrefs/weakrefs_003.phpt
@@ -4,40 +4,25 @@ WeakReference object handlers
<?php
$wr = WeakReference::create(new stdClass);
-try {
- $wr->disallow;
-} catch (Error $ex) {
- var_dump($ex->getMessage());
-}
-
-try {
- $wr->disallow = "writes";
-} catch (Error $ex) {
- var_dump($ex->getMessage());
-}
-
-try {
- isset($wr->disallow);
-} catch (Error $ex) {
- var_dump($ex->getMessage());
-}
+var_dump($wr->disallow);
+var_dump(isset($wr->disallow));
+unset($wr->disallow);
try {
- unset($wr->disallow);
+ $wr->disallow = "writes";
} catch (Error $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
try {
- $disallow = &$wr->disallowed;
+ $disallow = &$wr->disallowed;
} catch (Error $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
?>
---EXPECT--
-string(47) "WeakReference objects do not support properties"
-string(47) "WeakReference objects do not support properties"
-string(47) "WeakReference objects do not support properties"
-string(47) "WeakReference objects do not support properties"
-string(56) "WeakReference objects do not support property references"
-
+--EXPECTF--
+Warning: Undefined property: WeakReference::$disallow in %s on line %d
+NULL
+bool(false)
+string(55) "Cannot create dynamic property WeakReference::$disallow"
+string(57) "Cannot create dynamic property WeakReference::$disallowed"
diff --git a/Zend/tests/weakrefs/weakrefs_005.phpt b/Zend/tests/weakrefs/weakrefs_005.phpt
index a9ba45b760..cefc558f12 100644
--- a/Zend/tests/weakrefs/weakrefs_005.phpt
+++ b/Zend/tests/weakrefs/weakrefs_005.phpt
@@ -5,7 +5,7 @@ WeakReference no __construct
new WeakReference();
?>
--EXPECTF--
-Fatal error: Uncaught Error: Direct instantiation of 'WeakReference' is not allowed, use WeakReference::create instead in %s:2
+Fatal error: Uncaught Error: Direct instantiation of WeakReference is not allowed, use WeakReference::create instead in %s:2
Stack trace:
#0 %s(2): WeakReference->__construct()
#1 {main}
diff --git a/Zend/tests/xor_001.phpt b/Zend/tests/xor_001.phpt
index 1a6d0fb633..9678af16b5 100644
--- a/Zend/tests/xor_001.phpt
+++ b/Zend/tests/xor_001.phpt
@@ -6,11 +6,14 @@ XORing arrays
$a = array(1,2,3);
$b = array();
-$c = $a ^ $b;
-var_dump($c);
+try {
+ $c = $a ^ $b;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
--EXPECT--
-int(1)
+Unsupported operand types: array ^ array
Done
diff --git a/Zend/tests/zend_signed_multiply-64bit-2.phpt b/Zend/tests/zend_signed_multiply-64bit-2.phpt
index aa8ee47db6..dab3050ed4 100644
--- a/Zend/tests/zend_signed_multiply-64bit-2.phpt
+++ b/Zend/tests/zend_signed_multiply-64bit-2.phpt
@@ -6,37 +6,37 @@ Zend signed multiply 64-bit, variation 2
<?php
for($c = -16; $c < 0; $c++) {
var_dump($c, intdiv(PHP_INT_MIN, 10), intdiv(PHP_INT_MIN, 10) * $c);
- echo "-----------\n";
+ echo "-----------\n";
}
for($c = 0; $c <= 16; $c++) {
var_dump($c, intdiv(PHP_INT_MAX, 10), intdiv(PHP_INT_MAX, 10) * $c);
- echo "-----------\n";
+ echo "-----------\n";
}
?>
--EXPECT--
int(-16)
int(-922337203685477580)
-float(1.4757395258968E+19)
+float(1.4757395258967642E+19)
-----------
int(-15)
int(-922337203685477580)
-float(1.3835058055282E+19)
+float(1.3835058055282164E+19)
-----------
int(-14)
int(-922337203685477580)
-float(1.2912720851597E+19)
+float(1.2912720851596687E+19)
-----------
int(-13)
int(-922337203685477580)
-float(1.1990383647911E+19)
+float(1.1990383647911209E+19)
-----------
int(-12)
int(-922337203685477580)
-float(1.1068046444226E+19)
+float(1.1068046444225733E+19)
-----------
int(-11)
int(-922337203685477580)
-float(1.014570924054E+19)
+float(1.0145709240540254E+19)
-----------
int(-10)
int(-922337203685477580)
@@ -124,25 +124,25 @@ int(9223372036854775800)
-----------
int(11)
int(922337203685477580)
-float(1.014570924054E+19)
+float(1.0145709240540254E+19)
-----------
int(12)
int(922337203685477580)
-float(1.1068046444226E+19)
+float(1.1068046444225733E+19)
-----------
int(13)
int(922337203685477580)
-float(1.1990383647911E+19)
+float(1.1990383647911209E+19)
-----------
int(14)
int(922337203685477580)
-float(1.2912720851597E+19)
+float(1.2912720851596687E+19)
-----------
int(15)
int(922337203685477580)
-float(1.3835058055282E+19)
+float(1.3835058055282164E+19)
-----------
int(16)
int(922337203685477580)
-float(1.4757395258968E+19)
+float(1.4757395258967642E+19)
-----------
diff --git a/Zend/tests/zend_signed_multiply-64bit.phpt b/Zend/tests/zend_signed_multiply-64bit.phpt
index 20ef277770..615c67b966 100644
--- a/Zend/tests/zend_signed_multiply-64bit.phpt
+++ b/Zend/tests/zend_signed_multiply-64bit.phpt
@@ -11,4 +11,4 @@ var_dump(0x80000001 * -0xffffffff);
--EXPECT--
int(-9223372034707292160)
int(9223372036854775806)
-float(-9.2233720390023E+18)
+float(-9.22337203900226E+18)
diff --git a/Zend/tests/zend_strtod.phpt b/Zend/tests/zend_strtod.phpt
index 4530ce2e8c..af7b612844 100644
--- a/Zend/tests/zend_strtod.phpt
+++ b/Zend/tests/zend_strtod.phpt
@@ -14,6 +14,6 @@ echo "Done\n";
--EXPECT--
float(-100)
float(808792757210)
-float(-4.5646456464565E+27)
-float(-1.1276204760067E+16)
+float(-4.5646456464564635E+27)
+float(-11276204760067310)
Done